使用 XSL:FO 向 PDF 添加附件 [英] Use XSL:FO to add attachments to PDF

查看:43
本文介绍了使用 XSL:FO 向 PDF 添加附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SO 的帮助下解决内联图像后,我需要整理内联附件.PDF 可以包含附件,我发现:fo:declarations - pdf:embedded-file 但它又指向了一个外部文件.如何附加作为 MIME 消息一部分的文件(很可能是 BASE64)?

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

推荐答案

在最新的 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>

这篇关于使用 XSL:FO 向 PDF 添加附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆