PDFTK的文档中没有提到如何做到这一点。命令:
pdftk file.pdf attach_files attachDoc.pdf to_page 2 output -
将在原件的第 2 页附加一个文件file.pdf
并将结果输出到<stdout>
.
attachDoc.pdf
是文件系统的文件名。但我无法为此指定任何描述,以使用适当的符号描述在最终文件中显示附件。
这将特别有用,因为在自动生成操作中,附件通常具有由服务器分配的临时名称,并且需要描述
有什么办法可以做到这一点吗?
简短回答:
You cannot (currently) add the description of a file attachment when using pdftk
.
(However, it should be not too complicated to add this feature, because it only requires an additional key entry /Desc
to the file attachment dictionary... Maybe you should submit a feature request to the pdftk
developers?)
更长的答案:
在 Ghostscript(最新版本)的帮助下,您也许能够实现您想要的目标。但请注意,这相当复杂!
它需要使用特殊的 PostScript 扩展来定义pdfmark操作员 http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdfmarkReference_v9.pdf。创建此运算符的目的是将高级功能插入到 PDF 文件中,而这些功能不能在 PostScript 本身中使用。
我将借助一个单独的文件来演示它,该文件使用一系列pdfmark
将文本文件插入 PDF 的操作。这是文本文件的内容,mypdfmark-for-attachments.ps
:
[ /NamespacePush pdfmark
[ /_objdef {fstream} /type /stream /OBJ pdfmark
[ {fstream} << /Type /EmbeddedFile >> /PUT pdfmark
[ {fstream} (I only simulate text file content here...)
/PUT pdfmark
[ /Name <feff 0044 005a 005a 005a 005a 005a>
/FS<<
/Desc (dEsCrIpTiOn)
/Type /Filespec
/F (my.txt)
/EF <<
/F {fstream}
>>
>> /EMBED pdfmark
[ {fstream} /CLOSE pdfmark
[ /NamespacePop pdfmark
如您所见,/Desc
键保存我的描述文本dEsCrIpTiOn
.
现在运行这个 Ghostscript 命令:
gs -o emb.pdf -sDEVICE=pdfwrite mypdfmark-for-attachments.ps -f some.pdf
以下是 Acrobat 显示的生成的 PDF 文件的屏幕截图:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)