use*_*846 4 pdf graphics postscript hyperlink
它对我来说超级迷茫,因为pdfmaker和postscript都是一样的,但在实践中编码风格却截然不同.
我知道如何使用Postscript语言中的moveto和lineto以及arc命令在其末尾创建一个2行的行,但是,由于超链接,显然我必须转移到pdfmark,pdfmark手册是超级不可理解的,并且没有其他参考书(书/在线教程).
所以,我会很感激,如果有人可以用一点描述产生这样的东西(如我的图所示).

这是最简单的版本.这会在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
Run Code Online (Sandbox Code Playgroud)
默认情况下,将绘制一个边框,以便您可以清除它:
[/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
Run Code Online (Sandbox Code Playgroud)
但是,这只会创建一个可点击区域.然后,您需要绘制一些文本以单击:
/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
Run Code Online (Sandbox Code Playgroud)
最后,pdfmark在技术上没有在标准中定义,因此他们建议如果你没有使用Adobe的Distiller,你定义了一些东西来处理它.pdfmark如果编译器无法识别它,那么这段代码基本上就会忽略:
/pdfmark where
{pop}
{
/globaldict where
{ pop globaldict }
{ userdict }
ifelse
/pdfmark /cleartomark load put
}
ifelse
Run Code Online (Sandbox Code Playgroud)
这是一个完整的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
Run Code Online (Sandbox Code Playgroud)
编辑
另外,请查阅本手册以获取更深入的说明pdfmark
编辑2
此外,我还应该指出,我出于教学目的而将事情分开.在大多数情况下,您会看到/Action写为单行,例如:
/Action << /Subtype /URI /URI (http://www.example.com/) >>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1538 次 |
| 最近记录: |