2

After resolving inline images with help from SO, I need to sort out inline attachments. PDF can contain attachments and I found:fo:declarations - pdf:embedded-file but again it pointed to an external file. How can I attach a file that is part of a MIME message (most likely BASe64)?

Community
  • 1
  • 1
stwissel
  • 20,110
  • 6
  • 54
  • 101

1 Answers1

5

In the latest FOP builds, you can use the same syntax for pdf:embedded-file as for fo:external-graphic and directly append the base64 data:

<fo:declarations>
  <pdf:embedded-file filename="myfile.pdf" src="data:application/pdf;base64,<DATA>"/>
</fo:declarations>
...
<fo:basic-link external-destination="url(embedded-file:myfile.pdf)">Embedded PDF</fo:basic-link>
Martin
  • 1,748
  • 1
  • 16
  • 15
  • cool. Does 'latest build' mean I have to compile from source or is a CA. 1 week old binary download OK? – stwissel May 03 '12 at 05:55
  • I don't know exactly when this feature was added. It's not implemented in the 1.0 release but has been present in the trunk for several months now. So, a recent nightly build should be fine. – Martin May 03 '12 at 06:44
  • Trying to pass base64 data as part of xml and doesn't seem to work, i declared a variable and point it to xml tag with the data and doesn't seem to be used in any way, any ideas? – KgaboL May 03 '18 at 05:47