且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用XSL:FO将附件添加到PDF

更新时间:2023-10-01 23:09:16

在最新的FOP版本中,您可以对pdf:embedded-file使用与fo:external-graphic相同的语法,并直接附加base64数据:

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>