Login  Register

Re: Diagrams referenced by URL in PDF?

Posted by mojavelinux on Apr 21, 2016; 7:32am
URL: https://discuss.asciidoctor.org/Diagrams-referenced-by-URL-in-PDF-tp4623p4627.html

Thomas,

As you know, PDF is a self-contained format, so all resources must be embedded into it at build time. The HTML works because HTML can just link to the asset. So, yes, the PDF generator needs to download these resources from the internet.

Asciidoctor supports automatically downloading resources from the internet to embed them into the document. However, this feature is "hidden" behind a security flag. You need to enable the allow-uri-read attribute from the CLI or API.

 $ asciidoctor-pdf -a allow-uri-read document.adoc

To avoid slowing down the build, you can enable the (very primitive) URI cache.

 $ gem install open-uri-cached

Then you can enable the URI cache:

 $ asciidoctor-pdf -a allow-uri-read -a cache-uri document.adoc

The cache is stored in /tmp/open-uri-{uid}.

Cheers,

-Dan

On Wed, Apr 20, 2016 at 11:34 AM, wolandscat [via Asciidoctor :: Discussion] <[hidden email]> wrote:
If I include a diagram by URL reference, the HTML generates properly (as one would expect).

The PDF does not; the reference is just output in its literal form.

Should the PDF generator know how to do the inclusion? Or do I need to make a static copy of the diagram (which may change at source...) and save that, and then reference it locally to get it in the PDF?

- thomas


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Diagrams-referenced-by-URL-in-PDF-tp4623.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen