Use XSL:FO to add attachments to PDF

孤街浪徒 提交于 2019-12-08 01:28:18

问题


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)?


回答1:


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>


来源:https://stackoverflow.com/questions/10409103/use-xslfo-to-add-attachments-to-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!