-
Notifications
You must be signed in to change notification settings - Fork 133
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
Example to create PDF with diagrams #15
Comments
@pajoma Thanks for the submission! I'm not quite clear if this is a request to add the original sample or if it is asking for help with the second sample? |
It depends ;) If the second approach is the preferred way (which I guess it should be, since it seems cleaner without the gems), then this is a request to include it into the examples (if a solution to the image problem exists). In the other case, see the first approach as a suggestion which could be included it to the original examples. |
Using AsciidoctorJ Diagram is the preferred method for the reason you cited (though, keep in mind, you always have the option of switching to using the gem directly...so there's no wrong way).
This is a common problem with Asciidoctor Diagram and build tools because we have a lot of different directories involved. What it comes down to is that, when running the PDF converter, the Unlike the HTML converter, the PDF converter has to be able to find and read the generated images in order to include them in the document. That location must be the same as for all other images (Asciidoctor only looks in one place for images). It's an engineering challenge we've yet to solve transparently. |
The provided example can be simplified to not fetch Ruby Gems, by using
And as example, in
VersionsI think |
I think we're still waiting on this release. It is possible to upgrade AsciidoctorJ independently of the plugin, though we probably want to keep configuration to a minimum for the example, so best to wait.
👍 |
I had some trouble getting this to work with multiple backends. Ultimately I used the following Gradle:
And added the following attributes to the document:
There's probably a more elegant way, but this seems to work correctly. So, as I understand it, what is happening is the following:
|
That really depends on how the images are being referenced. If you are generating images into the build directory, and you want the converter to look for all images there, then yes, you need to copy the static images there before the converter runs. |
I'm trying to migrate from using the rubygems directly but diagram generation fails because |
@robfletcher, yes. You have to install it separately. |
are there any updates on the handling of the image path? |
Yes. I describe the solution in the following comment: asciidoctor/asciidoctor-pdf#271 (comment) and some more information here: |
I recommend looking at what the junit5 project is doing since they have a working configuration. |
FYI I managed to create a less complex setup in https://github.com/arc42/quality-requirements. The generated PDF (and docx via pandoc) are created via TravisCI and uploaded to Github Releases for each Git tag. |
Another option to this is, to create a new task just for the PDF backend. The advantage is, you don't have to deal with
By the way: why couldn't this be handled by the plugin? |
NOTE: this currently does *not* work see issue asciidoctor#15
I created a new asciidoc-diagram-to-pdf-example project in a fork and would like to make it work. After that, I would like to update the asciidoc-to-all-example project so it also uses a diagram to show how to make a single project use diagrams with output to html5 and pdf. Is one of the examples in this issue the recommended approach? |
NOTE: this currently does *not* work see issue asciidoctor#15
@jeffcjohnson You could enhance asciidoc-diagram-to-html-example to produce both html and pdf. If you aren't keen on that idea, then I'd recommend adding a separate project / folder. Feel free to submit the PR and I'm sure it will get merged. |
@mojavelinux I created the example to show how it could be done and failed. I was hoping someone that knew more about the project would be able to show where I went wrong. |
Oops, I missed that you had submitted #49. The reason it failed is because you were ahead of your time. Using the latest versions, it should now work. I'll give it a quick test. |
With a few upgrades, it works. The last step would be to merge it with asciidoc-diagram-to-html-example into a single example named asciidoctor-diagram-example. I don't think the "to" part is needed. The focus is on Asciidoctor Diagram, not the output. |
@mojavelinux thank you! I will try to get your suggestions into the PR for your review. |
Here's a working example to generate PDFs with PlantUML diagrams
Changes to the HTML5 Version
com.github.jruby-gradle.base
to 0.3.0 due to errors (current version is 1.2.0, but won't work)org.asciidoctor.convert
Here is another example which uses the diagram plugin from asciidoctorj. It compiles, but I don't get how to include the images in the PDF (the generated diagram images are in the built directory, the PDF-Compiler expects them in the source directory).
The text was updated successfully, but these errors were encountered: