Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagram images look in source but save to -D directory #1033

Closed
philsturgeon opened this issue Apr 22, 2019 · 2 comments
Closed

Diagram images look in source but save to -D directory #1033

philsturgeon opened this issue Apr 22, 2019 · 2 comments
Assignees

Comments

@philsturgeon
Copy link

Hey folks, got a possible bug, not entirely sure what is happening but diagrams are not showing up in PDF mode. HTML mode has them.

= Foo
:doctype: book
:source-highlighter: coderay
:toc:
:plantumlconfig: plantuml.cfg

:imagesdir: 1-theory

include::1-theory/part.adoc[leveloffset=+1]

Then inside that part I include chapters, and inside there I have some diagrams:


.A completely synchronous approach to handling a payment from a GUI, with your API accepting the information and sending it off to an external API acting as a payment gateway.
[plantuml]
---------------------------------------------------------------------
@startuml

title Accepting Payments: Blocking the GUI and Synchronous

boundary "Web GUI" as GUI
control "API"
boundary "Payment Gateway" as PG

GUI -> API: POST /payments
API -> PG: POST /submitPaymentAttempt
PG -> PG: May take 30-60s to confirm
API <-- PG: HTTP 200 OK
GUI <-- API: HTTP 200 OK

@enduml
---------------------------------------------------------------------

When I generate PDF I get this:

$ asciidoctor-pdf -r asciidoctor-diagram -D generated src/book.adoc
asciidoctor: WARNING: image to embed not found or not readable: /Users/phil/src/book-build-apis-2/src/1-theory/diag-73dcaad0a36b3868b09a7b0e98c57b88.png
asciidoctor: WARNING: image to embed not found or not readable: /Users/phil/src/book-build-apis-2/src/1-theory/diag-b4ea45e8e2870fb0bf1c8853142cdf23.png
asciidoctor: WARNING: image to embed not found or not readable: /Users/phil/src/book-build-apis-2/src/1-theory/diag-9d0431ab3d1b4ed445e4e9914fc8c37e.png
asciidoctor: WARNING: image to embed not found or not readable: /Users/phil/src/book-build-apis-2/src/1-theory/diag-51464d066663393cf04a9fd636cf86c8.png

It seems to be looking in the source folder, but it has actually saved the files in the generated directory (the one specified in -D).

Screen Shot 2019-04-22 at 18 01 23

I just signed up as a R&D backer on Open Collective if that helps. You folks do amazing work!

@philsturgeon philsturgeon changed the title PlantUML puts images in wrong dir in PDF mode Diagram images look in source but save to -D directory Apr 22, 2019
@mojavelinux
Copy link
Member

While this is a long-standing issue with Asciidoctor Diagram integrations in general, there's a very simple fix for Asciidoctor PDF. Simply set the data-uri attribute when calling Asciidoctor and Asciidoctor Diagram will return absolute image paths, allowing Asciidoctor PDF to locate the images.

asciidoctor-pdf -r asciidoctor-diagram -a data-uri -D generated src/book.adoc

I'll make this the default behavior in the upcoming release (so long as you are also using Asciidoctor 2 or better).

@mojavelinux mojavelinux self-assigned this Apr 23, 2019
@mojavelinux mojavelinux added this to the v1.5.0.alpha.17 milestone Apr 23, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 23, 2019
… find images generated by Asciidoctor Diagram

- when data-uri is set, Asciidoctor Diagram returns absolute image paths
- this allow the input and output directory to differ while still allowing Asciidoctor PDF to locate generated images
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 23, 2019
… find images generated by Asciidoctor Diagram

- when data-uri is set, Asciidoctor Diagram returns absolute image paths
- this allow the input and output directory to differ while still allowing Asciidoctor PDF to locate generated images
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 23, 2019
… find images generated by Asciidoctor Diagram

- when data-uri is set, Asciidoctor Diagram returns absolute image paths
- this allow the input and output directory to differ while still allowing Asciidoctor PDF to locate generated images
@philsturgeon
Copy link
Author

This works, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants