Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Is it possible to generate a pdf containing attachments ? That is, embedding files into the document.
My specific case is a generated pdf based on a data set. I'd like to include the csv of the data set into the document. So they always stay together. Thx, Jan |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
The only way I know to do this is to put the CSV in a listing block, though I wouldn't recommend it if the data is large. I found some mentions of embedded files in the PDF/A specification discussions, but I don't know if it was accepted. Even if so, prawn / pdf-core (https://github.com/prawnpdf/pdf-core) would have to support it in order for us to make use of it in Asciidoctor PDF. (Though, there's also the possibility of adding prawn extension in Asciidoctor PDF, if someone was able to figure it out). Cheers, -Dan On Thu, Dec 14, 2017 at 1:16 AM, Jan [via Asciidoctor :: Discussion] <[hidden email]> wrote: Is it possible to generate a pdf containing attachments ? That is, embedding files into the document. ... [show rest of quote] Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I am thinking this could be done with a Java Postprocessor and PdfBox. But the PostProcessor (https://github.com/asciidoctor/asciidoctorj/blob/master/asciidoctorj-core/src/main/java/org/asciidoctor/extension/Postprocessor.java) uses Strings, which I don't think works for PDFs.
Btw, attachments are not supported by PDF/A standard. You can create a PDF/A with attachments and PDF readers will say it's fine, but is not legal according to specification. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Thanks for the insight, Abel! Actually, the Postprocessor works on the output of convert, which is only guaranteed to be an object. In the PDF converter, this is the Prawn document object. I remember discussing this with Robert at some point, but I'm not sure if it ever got mapped in AsciidoctorJ that way. Cheers, -Dan On Thu, Dec 14, 2017 at 2:51 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote: I am thinking this could be done with a Java Postprocessor and PdfBox. But the PostProcessor (https://github.com/ Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
OK, short answer: NO is not possible to write a Java PDF Postprocessor to manipulate the PDF.
Found the issue, (https://github.com/asciidoctor/asciidoctorj/issues/387) and it discusses the exact issue we have here. And it still happens with Asciidoctor 1.6.0.x, I wrote an extension for PDF and it fails with: Since the ouput object received is a #<Asciidoctor::Pdf::Converter>, the only way to interact with it is via Prawn or as Robert mentioned writting a whole PDF wrapper in Java. Last options is just reivneting the wheel to me, way out of our scope. But if instead of String it provided a Stream with the processed data, one could redirect it to any other API to manipulate it. Btw, I am laughing at Robert's sentece: Sooner or later, `yet` alwasy gets you. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Never say "never" indeed. :-)
|
Free forum by Nabble | Edit this page |