最后一页上的 Ghostscript PDFMARK 外部 link

Ghostscript PDFMARK external link on last page

我正在使用 Ghostscript 将一系列 Illustrator 文件转换为单个 PDF 文档。

在该生成的 pdf 文档中,我试图将外部 link 应用到文件的 最后一页 。为此,我创建了一个单独的 script.ps,其规则如下:

[ /Rect [0 0 528 771]
/Page 5
/Action << /Subtype /URI /URI (http://www.adobe.com) >>
/Border [0 0 2]
/Color [.7 0 0]
/Subtype /Link
/ANN pdfmark

我正在使用以下内容生成 PDF...

gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -o output.pdf script.ps -f 01.ai 02.ai 03.ai 04.ai 05.ai 

这只会在第一页创建一个 link。所以好像忽略了我在script.ps文件里写的/Page 5

如何在文档的最后一页应用 link?

我认为你的问题是你在执行 pdfmark 之前 你执行剩余的页面描述(顺便说一下,小心使用 Adob​​e Illustrator '.ai' 文件,这些不保证是有效的独立 PostScript)。

在您执行 pdfmark 时,没有 页面尚未定义,因此无法将页码转换为包含描述的 PDF 对象编号第 5 页。

尝试运行你的'script.ps'作为最终操作,而不是第一个。

我刚遇到这个,我的解决方案是使用 /SrcPg 而不是 /Page

示例:

[ /Rect [0 0 528 771]
/SrcPg 5
/Action << /Subtype /URI /URI (http://www.adobe.com) >>
/Border [0 0 2]
/Color [.7 0 0]
/Subtype /Link
/ANN pdfmark

输入文件的顺序似乎并不重要。