%! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PRE-PLACING ACROBAT URL LINKS INTO SOURCE TEXT DOCUMENTS % ======================================================== % by Don Lancaster Revised January 13, 1997 % =================================================================== % Copyright c 1997 by Don Lancaster and Synergetics, Box 809, % Thatcher AZ, 85552. (520) 428-4073 www.tinaja.com don@tinaja.com % All commercial rights and all electronic media rights are % *fully* reserved. Linking welcome. Reposting expressly forbidden. % =================================================================== % Acrobat EXCHANGE allows you to add all sorts of hypertext features % to print-based documents. One of these is the url link. Clicking on % such a link sends you elsewhere in cyberspace. % Just about anything that EXCHANGE can do can also be done by placing % non-printing marks in the source textfiles. These use the -pdfmark- % operator, and are thoroughly detailed in Adobe Technical note #5150. % Be sure to get the October 1996 update or later. % The difficulty of inserting these marks depends on the nature of % the original text files and upon your skill levels. Options include % sourcecode programming, use of SDK development kits, writing plug-ins % or waiting until someone else develops a suitable plug-in for you. % Listed below are the sourcecode url patches for my Gonzo PostScript % Utilities. Unlike using Exchange, text is auto-highlighted and the % auto-generated hot boxes auto-track the text position, even if text % moves during a later edit. These concepts may be adapted to different % document sourcing programs and applications generators. % File length increases by a modest few dozen bytes for each url link. % The patches start with a table of named url's. This table can be % a master list or only those needed for the document at hand. % Next is a routine to lock the -pdfmark- commands out of a printer % or other PostScript device that does not accept them. % An embedded -surl- marker gets placed at the beginning of the url % referenced text. This marker changes the color of subsequent text % and remembers the physical page position of the text color change. % An embedded named marker gets placed at the end of the url referenced % Text. This marker passes a specific url name to a -eurl- processor. % The -eurl_ ("end url") processor temp saves the name as -cururlname-. % The text color is then changed back to normal, and a -makeurl- % printtime proc referencing the specific url string is called. % -makeurl- generates a pdfmark array that is invisibly inserted into % the sourcecode. It first finds the current font height to get a hint % of how high to make the invisible "hot" rectangle. This height guess % is merged with the highlighted text start and end to generate the % /Rect data that specifies the hot rectangle size. The border can % optionally be turned on or off by uncommenting as noted. % Finally, -makeurl- generates the ANN (or "annotate") command and % invisibly inserts the pdfmark and its array into your document source. % Note that -surl- and -eurl- take place *BEFORE* justification and % formatting. -makeurl- takes place *AFTER* justification and formatting. % The hot box thus actively tracks the exact formatted text position. % %%%%%%%%%%%%%%%% GONZO URL PATCHES %%%%%%%%%%%%%%%%%%%%%%%%%%%% % patch definitions... /maildon {(mailto:don@tinaja.com) eurl } def /tinaja {(http://www.tinaja.com) eurl } def /consult {(http://www.tinaja.com/consul01.html) eurl} def /netscape {(http://www.netscape.com) eurl } def /adobe {(http://www.adobe.com) eurl } def /parallax {(http://www.parallaxinc.com) eurl } def /coriolis {(http://www.coriolis.com) eurl } def /hottalk {(mailto:hottalk@printer-net) eurl } def /hack73 {(http://www.tinaja.com/glib/hack73.pdf) eurl} def /hacklib {(http://www.tinaja.com/hack01.html) eurl} def /magic {(http://www.tinaja.com/magsin01.html) eurl} def /fourier {(http://www.tinaja.com/psutils/fourier.ps) eurl} def /zeroharm {(http://www.tinaja.com/psutils/zeroharm.ps) eurl} def /sincat210{(http://www.tinaja.com/sn210cat.ps) eurl} def % This code locks pdfmark commands out of a PostScript printer. /pdfmark where {pop}{userdict /pdfmark /cleartomark load put} ifelse % /surl "start url" marks the beginning of a text sequence to be urled. % It also paints the text blue... /surl {mark /blue cvx 0.33 /setgray cvx % change text to blue /currentpoint cvx % remember box start /urly /exch cvx /store cvx /urlx /exch cvx /store cvx ] cvx % complete deferred command printlist exch 3 index exch put % stuff into gonzo printlist exch 1 add exch % increment gonzo list count } def % /eurl "end url" unmarks the end of a text sequence and sets up % the pdfmark needed to define the Acrobat web link. /eurl {mark % start deferred proc exch % position url string /beige cvx 0 /setgray cvx % turn blue marker off /makeurl cvx % defer call of url builder ] cvx % complete deferred proc printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch % increment gonzo list count } def % /makeurl generates the pdfmark, receiving a {(urlstring) makeurl}. % Note that it is not called until formatted printlist time... /urlover 0.2 def % fraction of hot area over bounds /makeurl { /cururlname exch store % save the url string mark % start pdfmark currentfont /ScaleMatrix get 3 get /fsize exch store % guess height /Rect [ urlx fsize urlover mul sub % set box left x urly fsize urlover mul sub % set box left y currentpoint exch fsize urlover mul add exch % set box right x fsize add % set box right y ] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> % url goes here /Subtype /Link /ANN % annotation type pdfmark % call pdf operators } def % %%%%%%%%%%%%%%%%%%%% END GONZO URL PATCHES %%%%%%%%%%%%%%%%%%%%%% % Consulting services available on concepts shown. % =================================================================== % Copyright c 1997 by Don Lancaster and Synergetics, Box 809, % Thatcher AZ, 85552. (520) 428-4073 www.tinaja.com don@tinaja.com % All commercial rights and all electronic media rights are % *fully* reserved. Linking welcome. Reposting expressly forbidden. % ===================================================================