问题
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