2012-10-30 30 views
2

要求是显示一些pdf文本,其中有一个超链接在站点/ pdf/etc下面 - 类似于HTML,你会看到请点击这里和这里打开一个链接。PostScript - 超链接表,但只有一个链接被用于所有

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

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

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

在PlanetPress中,我基本上循环一个XML文件并将结果发送到.ps文件。

这里是我的PDFmarks代码:

 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') 

我用/计数申请,以确定正在读取/传递给PostScript文件,不同的价值观。 我已经使用/ rect &/border字段来创建超链接区域。我认为矩形将是超链接区域的边界,然而事实并非如此。 我尝试过使用moveto来确保光标正在沿页面移动,但对最终结果完全没有影响。 直通( ' '+ inttostr(floattoint(&宽* 72))+' '+ inttostr(floattoint(& j)条)+' 通过MoveTo')

我真的不知道的PostScript,但我认为这是一个的两个环节输出的块(我剪了下来,因为他们是真正的链接的链接)

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盒子之间休息一下,因为它们现在似乎共享一个边框,但我不知道该怎么做。 谢谢

回答

3

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

“现在我只需要弄清楚如何repeatidly使用所有4个点,重新绘制矩形”

我不知道我undertsand这个额外的问题。你问:“现在我已经为超链接的/ Rect获得了正确的值,我该如何在那里绘制一个矩形?”

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

+1

Doh!感谢那!我无法相信我看过每一个数字和空间,并没有对我自己产生的数字给予足够的关注。现在我只需要弄清楚如何使用所有4个点重新绘制矩形 – user1569869

相关问题