Solution to wp$box print command bug in word 2002

Z

zengancl

Recently i intended to insert pdf links into word document using method
suggested by the brilliant pdfmark primer from Thomas Merz. However the
"\p para" print command for wp$box in word 2002 was obviously broken
and i encountered the same wp$box problem as elaborated nicely in
http://groups.google.com.my/group/m...=pdfmark+wp$box&rnum=5&hl=en#4978cff2b8d17b02.


Googling around does not yield any helpful result even though the above
thread have been posted more than a year ago. After some investigation,
i finally found the fix that work for me:
For paper size: Letter, insert the following code into your field code
{PRINT PScode} in your VBA.
PScode = "\p para ""/xycorrect {491.51 div} def " _
& "/yocorrect {792 sub 491.51 div 792 add} def " _
& "/wp2$xorig {wp$xorig xycorrect} def /wp2$yorig {wp$yorig
yocorrect} def " _
& "/wp2$x {wp$x xycorrect} def /wp2$y {wp$y xycorrect} def " _
& "/newxorig {wp$xorig -1 mul} def /newyorig {wp$yorig -1 mul}
def " _
& "[ /Rect [newxorig wp2$xorig add newyorig wp2$yorig add " _
& "newxorig wp2$xorig add wp2$x add newyorig wp2$yorig add
wp2$y add] " _
& "/Color [1 0 0 ] /Page /Next /View [/XYZ -1 793 null]
/Subtype /Link /ANN pdfmark """

For paper size: A4, insert the following code to into your field code
{PRINT PScode} in your VBA.
PScode = "\p para ""/xycorrect {491.51 div} def " _
& "/yocorrect {842 sub 491.51 div 842 add} def " _
& "/wp2$xorig {wp$xorig xycorrect} def /wp2$yorig {wp$yorig
yocorrect} def " _
& "/wp2$x {wp$x xycorrect} def /wp2$y {wp$y xycorrect} def " _
& "/newxorig {wp$xorig -1 mul} def /newyorig {wp$yorig -1 mul}
def " _
& "[ /Rect [newxorig wp2$xorig add newyorig wp2$yorig add " _
& "newxorig wp2$xorig add wp2$x add newyorig wp2$yorig add
wp2$y add] " _
& "/Color [1 0 0 ] " & linkcom & linkarg & "/View [/XYZ -1 843
null] /Subtype /Link /ANN pdfmark """

If you insert field code directly into word document, remove the double
qoutes, ampersand and underscore accordingly. Edit the postscript
syntax, /Page, /Action, /Color etc. to suit your need. Lastly remember
to set the paper size accordingly at your postscript printer before
print to file otherwise all the bounding boxes will be out of place.

The code above works nicely for me and i hope it helps others.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top