inline images in conversion to pdf

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

inline images in conversion to pdf

Andrew J
Although I have been using asciidoc for some time now, I am new to asciidoctor and asciidoctor-pdf. I am also just starting to write documentation including inline images.

I have a lengthy (but relatively straightforward) asciidoc document to render both in html and pdf.  The document includes multiple inline images, generally using the syntax  

image:images/image.png[width=300,link="images/image.png"]

They come out fine rendered in html, but I am having problems converting to pdf with the latest release of asciidoctror-pdf.


I am getting loads of messages - asciidoctor: WARNING: conversion missing in backend pdf for inline_image

and, although I am getting a very nice looking pdf file, it does not contain any of the images!

Am I missing something here?

Thanks

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: inline images in conversion to pdf

mojavelinux
Administrator
This feature is in active development and there is an open pull request. If you have time to test it, that would really help move it forward.


As the implementation stands now, the inline image will not affect the line height. Therefore, it has to fit in the line or else it will overflow into the lines above and below. I'm looking into how difficult it will be to get the line height to shift if the image is larger.

Cheers,

-Dan

On Wed, Jun 10, 2015 at 4:30 AM, Andrew J [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Although I have been using asciidoc for some time now, I am new to asciidoctor and asciidoctor-pdf. I am also just starting to write documentation including inline images.

I have a lengthy (but relatively straightforward) asciidoc document to render both in html and pdf.  The document includes multiple inline images, generally using the syntax  

image:images/image.png[width=300,link="images/image.png"]

They come out fine rendered in html, but I am having problems converting to pdf with the latest release of asciidoctror-pdf.


I am getting loads of messages - asciidoctor: WARNING: conversion missing in backend pdf for inline_image

and, although I am getting a very nice looking pdf file, it does not contain any of the images!

Am I missing something here?

Thanks

Andrew


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/inline-images-in-conversion-to-pdf-tp3345.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: inline images in conversion to pdf

Andrew J
Thanks for the quick reply.

Forgive my ignorance - having cloned the current asciidoc-pdf git repository with

git clone https://github.com/asciidoctor/asciidoctor-pdf.git

How can I pull in pull request 178 (not really being a git person)

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: inline images in conversion to pdf

Andrew J
In reply to this post by mojavelinux
Dan,

Figured out how to download and merge in pull request.

And I do now get the inline images included in the pdf output - a step forward.

Unfortunately, they are not being scaled properly, so the final output does not look good at all.

But an improvement on not having them there at all!
Reply | Threaded
Open this post in threaded view
|

Re: inline images in conversion to pdf

mojavelinux
Administrator
On Wed, Jun 10, 2015 at 8:38 AM, Andrew J [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Figured out how to download and merge in pull request.

Great!

What resource did you use? I'd like to add it to our contribution section. How I do it is probably non-standard. 

 

And I do now get the inline images included in the pdf output - a step forward.

\o/
 

Unfortunately, they are not being scaled properly, so the final output does not look good at all.

You need to set the width (only the width matters). Play around with values until you get the appearance you want. It should be close to what you set for HTML as we are scaling the width the way that PDF roughly scales px to pt (multiply by 0.75).

Cheers,

-Dan

--
Reply | Threaded
Open this post in threaded view
|

Re: inline images in conversion to pdf

Thibault Duchateau
Hi,

I'm currently using Asciidoctor via the Maven plugin to generate my project's docs. Of course I've hit the same issue as Andrew when trying to generate in PDF.

After lots of tests, I've given up trying to test the PR via the Maven plugin. (Note: I'm not a ruby guy)
However, I've managed to convert a single file (normally included in a "parent" .adoc file) using the following command:

>ruby ./bin/asciidoctor-pdf C:\Users\thibz\foo\bar\src\asciidoc\_includes\asset-caching.adoc

Result: all images are rendered correctly, good job!

Now, I'd love to test the full PDF generation. Do you know if it's possible to test a "local gem" with the Maven plugin?
Note that for the POM, I took inspiration from https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-pdf-example/pom.xml.

Thanks!

Regards,
Thibault.
Reply | Threaded
Open this post in threaded view
|

Re: inline images in conversion to pdf

abelsromero
Thibault Duchateau wrote
Now, I'd love to test the full PDF generation. Do you know if it's possible to test a "local gem" with the Maven plugin?
Note that for the POM, I took inspiration from https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-pdf-example/pom.xml.
If you already compiled the gem, you should be able to use the gemPath parameter in the plugin to point to the gem folder.
I'm not a ruby guy neither, so I'm not sure if you need to install the gem locally (http://stackoverflow.com/questions/220176/how-can-i-install-a-local-gem) and point to the  local directory, or just point to the folder containing the gem.

Other things to keep in mind are:
· Add the ruby as 'required' to the plugin.
· Exclude de asciidoctor-pdf jar depencendy just to be sure no interference ocurre.

Here you can find the old way we used to add the gems when they were not embedded in asciidoctorj:
https://github.com/asciidoctor/asciidoctor-maven-examples/blob/a2b607384ed8745355bee88af2d9563073d0cf19/asciidoc-to-pdf-example/pom.xml.
In this case, gems are downloaded and stored in a local folder.

I hope it helps :)