PostScript - 超链接表,但只有一个链接用于所有链接 [英] PostScript - table of hyperlinks but only one link being used for all

查看:60
本文介绍了PostScript - 超链接表,但只有一个链接用于所有链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要求以 pdf 格式显示一些文本,其中包含指向站点/pdf/etc 的超链接 - 类似于 HTML,您将在其中看到,请单击此处并在此处打开一个链接.

The requirement is to show some text in a pdf which has a hyperlink underneath to a site/pdf/etc - similar to HTML where you will see please click here and here opens up a link.

我正在使用 PlanetPress 创建 pdf,它基本上是添加了维生素和铁的 PostScript 代码.

I'm using PlanetPress to create the pdf, which basiclly is PostScript code with added vitamins and iron.

当在文本中找到 http://时,Acrobat 会自动创建链接,因此 PlanetPress 不直接处理链接(因为它们是由 Acrobat 自动创建的).

Acrobat automatically creates links when http:// is found within the text, as a consequence PlanetPress does not handle links directly (because they are created automatically by Acrobat).

我可以通过直接通过 PlanetPress 传递 PDFMark PostScript 代码来创建满足我们要求的静态链接,但是当我尝试对多行代码动态执行相同操作时,列表中的最后一个链接成为每一行的链接.

I can create static links that meet our requirements by passing PDFMark PostScript code directly through PlanetPress however when I try to do the same dynamically for a number of lines of code, the final link within the list becomes the link for each line.

在 PlanetPress 中,我基本上是遍历 XML 文件并将结果发送到 .ps 文件.

In PlanetPress I'm basiclly looping through an XML file and sending the results to the .ps file.

这是我的 PDFmarks 代码:

Here is my PDFmarks code:

        passthrough('[ /Rect [ 0 0 16 '+inttostr(floattoint(&j))+' ]')
        passthrough('/Action << /Subtype /URI /URI ('+&CentreCodeLink+') >>')
        passthrough('/Count '+IntToStr(&i)+'')
        passthrough('/Subtype /Link')
        passthrough('/Border [ 1 1 1 ]')
        passthrough('/ANN pdfmark')

我已经使用/count 文件来确定不同的值正在被读取/传递到 PostScript 文件.我使用了/rect &/border 字段以创建超链接区域.我认为矩形将是超链接区域的边界,但事实并非如此.我尝试使用 moveto 来确保光标沿页面移动,但这对最终结果根本没有影响.passthrough(' '+inttostr(floattoint(&width*72))+' '+inttostr(floattoint(&j))+' moveto')

I've used the /count filed to determine that different values are being read/passed to the PostScript File. I've used the /rect & /border fields to create a hyperlink area. I thought that the rectangle would be the boundries of the hyperlink area however this isn't the case it seems. I've tried using moveto to ensure the cursor is moving along the page but this has no effect on the end result at all. passthrough(' '+inttostr(floattoint(&width*72))+' '+inttostr(floattoint(&j))+' moveto')

我不太了解 PostScript,但我认为这是两个链接输出的一部分(我已经将链接剪掉了,因为它们是真正的链接)

I don't really know PostScript but I think this is a chunk of the output of two links (I've cut the links down because they were real links)

0 0 *m
213.9994 30.00256 *m
0 35.00296 *m
*gr
*gs
[1 0 0 1 0 70.75305]concat
 /^PP$ {systemdict /show get exec} *bd
&body /$ 1 index 2 get store /_ 1 index 6 get store 1 get *sf
 /^PP$ {systemdict /show get exec} *bd
&bold /$ 1 index 2 get store /_ 1 index 6 get store 1 get *sf
36 12.00037 *m
36 12.00037 *m (London - Hammersmith) $
165.6 12.00037 *m
&weblinkstyle dup 0 get [9 0 0 -9 0 0] *mf *sf
 /^PP$ {systemdict /show get exec} *bd
[] 0 setdash
/$ 1 index 5 get dup 0 {1 1 0 0 *sc}*bi put store /_ exch 8 get dup 0 {1 1 0 0 *sc}*bi put store
165.6002 12.00037 *m (London - Angel) $
([ /Rect [ 0 0 540 16 ]) cvx exec
(/Action << /Subtype /URI /URI \(http://WelcomePacka5LondonAngel/\) >>) cvx exec
(/Count 1) cvx exec
(/Subtype /Link) cvx exec
(/Border [ 1 1 1 ]) cvx exec
(/ANN pdfmark) cvx exec
( 540 16 moveto) cvx exec
 /^PP$ {systemdict /show get exec} *bd
&bold /$ 1 index 2 get store /_ 1 index 6 get store 1 get *sf
36 24.00073 *m
36 24.00073 *m (London - London Bridge) $
165.6 24.00073 *m
&weblinkstyle dup 0 get [9 0 0 -9 0 0] *mf *sf
 /^PP$ {systemdict /show get exec} *bd
[] 0 setdash
/$ 1 index 5 get dup 0 {1 1 0 0 *sc}*bi put store /_ exch 8 get dup 0 {1 1 0 0 *sc}*bi put store
165.6002 24.00073 *m (London - Bridge / Borough High Street) $
([ /Rect [ 0 0 540 28 ]) cvx exec
(/Action << /Subtype /URI /URI \(http://WelcomePacka5LondonBridge/\) >>) cvx exec
(/Count 2) cvx exec
(/Subtype /Link) cvx exec
(/Border [ 1 1 1 ]) cvx exec
(/ANN pdfmark) cvx exec
( 540 28 moveto) cvx exec
 /^PP$ {systemdict /show get exec} *bd

任何想法为什么这些不起作用?我在想也许我需要在每个 pdfmark 框之间休息一下,因为它们现在似乎共享一个边框,但我不知道该怎么做.谢谢

Any ideas why these don't work? I was thinking maybe I need to have a break between each pdfmark box as they seem to share a border now but I don't know how to do this. Thanks

推荐答案

/Rect 确实定义了链接的矩形.但看起来代码的矩形左下角值为 0, 0 对于所有矩形.因此矩形是重叠的,因此顶部的(创建的最后一个)将是单击时被激活的那个.记住,/Rect[ "lower left x" "lower left y" "upper right x" "upper right y" ],所以前两个值定义了下矩形的左点和最后两个值定义了矩形的右上角.

The /Rect does define the rectangle for the link. But it looks like the code has the lower left value of the rectangle at 0, 0 for all the rectangles. So the rectangles are overlapping, thus the top one (the last one created) would be the one that gets activated when clicked. Remember, /Rect is [ "lower left x" "lower left y" "upper right x" "upper right y" ], so the first two values define the lower left point of the rectangle and the last two values define the upper right point of the rectangle.

现在我只需要弄清楚如何使用所有 4 个点重复地重绘矩形"

我不确定我是否理解了这个附加问题.您是否在问:既然我拥有超链接的/Rect 的正确值,我该如何在那里绘制矩形?"

I am not sure I undertsand this additional question. Are you asking, "Now that I have the correct values for the /Rect for the hyperlink, how do I draw a rectangle there?"

要找到矩形的所有四个点,您只需使用 /Rect 中的信息值.例如,说 /Rect [ 70 680 110 690 ],那么矩形的四个点是 (70,680)、(70,690)、(110,680) 和 (110,690).您可以使用适当的绘图命令来绘制该矩形.

To find all four points of the rectangle you simply use the information from the /Rect values. So for example, say /Rect [ 70 680 110 690 ], then the four points for the rectangle are (70,680), (70,690), (110,680), and (110,690). You can use appropriate drawing commands to draw that rectangle.

这篇关于PostScript - 超链接表,但只有一个链接用于所有链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆