它对我来说非常令人困惑,因为 pdfmaker 和 postscript 正在做同样的事情,但实际上编码风格却大不相同。
我知道如何使用 Postscript 语言中的 moveto 和 lineto 和 arc 命令在其末端制作一 strip 有 2 个圆圈的线,但是,显然由于超链接,我必须移动到 pdfmark,pdfmark manual super 难懂,没有其他引用资料(书籍/在线教程)。
所以,我将不胜感激,如果有人能用一点描述来生成这样的东西(如图所示)。
最佳答案
这是最简单的版本。这会在 PDF 的左下角创建一个可点击的区域,该区域会转到 URL。
[/Rect [ 0 0 200 200 ] % Draw a rectangle
/Action % Define an action
<<
/Subtype /URI % Define the action's subtype as a hyperlink
/URI (http://www.example.com/) % Set the URL
>>
/Subtype /Link % Set the type of this PDFmark to a link
/ANN pdfmark % Add the annotation
默认情况下,将绘制边框,因此您可能需要清除它:
[/Rect [ 0 0 200 200 ] % Draw a rectangle
/Action % Define an action
<<
/Subtype /URI % Define the action's subtype as a hyperlink
/URI (http://www.example.com/) % Set the URL
>>
/Border [0 0 0] % Remove the border
/Subtype /Link % Set the type of this PDFmark to a link
/ANN pdfmark % Add the annotation
然而,这只会创建一个可点击的区域。然后,您需要绘制一些文本以单击:
/Helvetica findfont 16 scalefont setfont % Set the font to Helvetica 16pt
5 100 moveto % Set the drawing location
(http://www.example.com/) show % Show some text
最后,
pdfmark
技术上没有在标准中定义,所以他们建议如果你不使用 Adobe 的 Distiller,你可以定义一些东西来处理它。这段代码基本上会忽略 pdfmark
如果编译器不能识别它:/pdfmark where
{pop}
{
/globaldict where
{ pop globaldict }
{ userdict }
ifelse
/pdfmark /cleartomark load put
}
ifelse
这是一个完整的 PostScript 程序:
%!PS-Adobe-1.0
/pdfmark where
{pop}
{
/globaldict where
{ pop globaldict }
{ userdict }
ifelse
/pdfmark /cleartomark load put
}
ifelse
[/Rect [ 0 0 200 200 ] % Draw a rectangle
/Action % Define an action
<<
/Subtype /URI % Define the action's subtype as a hyperlink
/URI (http://www.example.com/) % Set the URL
>>
/Border [0 0 0] % Remove the border
/Subtype /Link % Set the type of this PDFmark to a link
/ANN pdfmark % Add the annotation
/Helvetica findfont 16 scalefont setfont % Set the font to Helvetica 16pt
5 100 moveto % Set the drawing location
(http://www.example.com/) show % Show some text
showpage
编辑
另外,check out this manual有关
pdfmark
的更深入说明编辑 2
另外,我还应该指出,为了教学目的,我已经将东西隔开。在大多数情况下,您会看到
/Action
写成一行,例如:/Action << /Subtype /URI /URI (http://www.example.com/) >>
关于pdf - 在 postscript 和 pdfmaker 末尾带有两个超链接的简单行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7051024/