如您所见,圈子周围有几个ID,我不确切知道他们的协调性(很难!)。因此,想知道是否有人有想法,为每个ID附加超链接,这意味着通过点击ID,用户转移到相应的网页上。
我把代码HERE
此圈子由postscript脚本生成!!
答案 0 :(得分:3)
使用如下结构绘制文本:
247 ux 160.65 uy moveto (GH6) show stroke
您需要添加pdfmark操作,您要使用的确切pdfmark取决于您要打开的内容以及位置。如果要打开另一个PDF文件,可以使用带有GoToR操作的链接注释,如果要打开网页,可以使用“启动”操作或可能的自定义操作,具体取决于查看PDF文件的应用程序。我假设你想要一个发射动作。
Launch pdfmark应该类似于:
[/Rect [50 425 295 445] /Action /Launch /Border [0 0 2] /Color [.7 0 0] /URI (http://www.adobe.com) /Subtype /Link /ANN pdfmark
显然,您需要计算Rect参数,以便单击文本区域将启动目标。
执行此操作的方法是使用PostScript路径运算符。首先,我们需要保存当前设置,然后将文本转换为路径,然后计算路径的边界框。然后我们可以将这些坐标用于我们的Rect参数。
例如:
247 ux 160.65 uy moveto (GH6) dup % copy the string gsave % save the current environament exch % bring the string copy to the top of the stack [ /Rect % Put a mark and name on stack 3 -1 roll % Bring string copy to top true charpath % create a path equivalent to drawing the text flattenpath % flatten curves pathbbox % get the bounding box % we now have our box on the stack % stack is: (GH6) [ /Rect llx lly urx ury % So put the other parameters in place /Action /Launch /Border [0 0 2] /Color [.7 0 0] /URI (www.dummy.com) /Subtype /Link /Ann pdfmark % and execute the pdfmark grestore % put the graphics state back show stroke
部分文字通过略有不同的习语显示:
241 ux 84.65 uy moveto (45.0) dup stringwidth pop 2 div neg 0 rmoveto show
你可以像上面那样做,只需在rmoveto之后和节目之前放置dup ... grestore构造。
警告:我根本没有测试过,但它应该告诉你如何继续。
答案 1 :(得分:2)
无论PostScript程序的哪个部分绘制数字ID,还需要包含一个pdfmark,其中包含网页URI的/ Dest。它可能还需要指定/ AP外观流。
在原始的PostScript程序中这可能是微不足道的,但正如BryanH暗示的那样,如果不看原始的PostScript就不可能指出。
当然假设数字是由PostScript程序绘制的,将PostScript转换为PDF的工具理解pdfmark扩展名运算符。
答案 2 :(得分:0)
KenS的例子正是我一直在寻找的,但只做了一个小改动:
[ pathbbox ]
即
/Arial findfont 20 scalefont setfont
100 200 moveto (riverdrums)
dup gsave exch
[ /Rect 3 -1 roll true charpath flattenpath [ pathbbox ]
/Action << /Subtype /URI /URI (http://riverdrums.com) >>
/Border [0 0 0]
/Subtype /Link
/ANN pdfmark
grestore
show