Further support on www.tinaja.com
(The following is believed correct. Please report any errors or differing experiences.)
There can be some compelling advantages
to using Acrobat instead of HTML for web
pages. In one fast loading single file, you get unlimited fonts and exact
camera ready copy.
You get magnification and text smoothing. You get borderless full screen
displays. You get
surprise-free total and absolute control of what your viewers see.
On the downside, not everyone has Acrobat readers installed, so some
viewers may not be
able to view your site. Browser forward and backward arrows may not yet
work properly.
Actual links may not be identified with the browser tag line, and followed
links do not usually
change color. There are also some "not quite seamless yet" details
to be worked out as well.
The code that follows shows you how to do a portion of a PDF file that
"looks" like a HTML
web page, only better. You get a table-like arrangement of hot linked buttons
and hot text in
an eight menu item selection. You can view http://www.tinaja.com/glib/awebdemo.pdf
to see
and test the working results.
The 11K PDF file size includes button artwork and fancy font
defs. When properly written
PDF procs replace multiple custom images, the bytes transferred using PDF
can end up significantly less than HTML.
The code uses my gonzo utilities found in
http://www.tinaja.com/psutils/gonzo20.ps
But is easily adapted to work with any PostScript host coding.
%!PS-Adobe-3.0
% Some Acrobat Web Page Utilities to do a table-like eight
% menu item box and text highlight selection
(C:\\windows\\desktop\\gonzo\\gonzo.ps) run % run the gonzo
utils
gonzo begin %
activate gonzo utils
ps.util.1 begin
nuisance begin
% Define a 28 pixel square hot linked button
% ==========================================
/button { makeurlx %
make box shaped url
gsave 0.65 settint
xpos ypos 0.9 sub translate
0.1 dup scale 0 0 mt 28 pu 28 pr 28 pd closepath 0.85 setgray
fill 0 0 mt 0 28 pu 4 -4 rlineto 20 pd 20 pr 4 -4 rlineto
closepath 0.6 setgray fill 0 28 mt 28 pr 28 pd -4 4 rlineto
20 pu 20 pl closepath 0.75 setgray fill
8 8 mt 12 pu 13 -6 rlineto closepath 0.33 setgray fill grestore
xpos ypos mt} def
% Define the hot link url info
% ============================
% This code locks pdfmark commands out of a PostScript printer.
/pdfmark where {pop}{userdict /pdfmark /cleartomark load put} ifelse
% /surl 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 %
finish 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
/black 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 fsize add ] /Border [ 0 0 0] % [0 0 0 ] = none
/Color [ .7 0 0 ]
% invisible red
/Action <</Subtype /URI /URI cururlname>>
/Subtype /Link /ANN %
annotation type
pdfmark %
call pdf operators
} def
% /makeurlx generates the box specific pdfmark, receiving % a {(urlstring) makeurl}. % Note that it is not called until formatted printlist time...
/makeurlx { /cururlnamex exch store % save
the url string
mark %
start pdfmark
/Rect [ xpos %
set box left x
ypos 0.9 sub %
set box left y
xpos 2.8 add %
box right x
ypos 0.9 sub 2.8 add %
box right y
]
/Border [ 0 0 0] %
[0 0 0 ] = none; [0 0 2] = debug
/Color [ .7 0 0 ]
/Action <</Subtype /URI /URI cururlnamex>> /Subtype
/Link /ANN %
annotation type
pdfmark %
call pdf operators
} def
% text link specific data
/syncat01 {(http://www.tinaja.com/glib/syncat01.pdf) eurl} def
/ismm01 {(http://www.tinaja.com/ismm01.html) eurl} def
/amlink01 {(http://www.tinaja.com/amlink01.html) eurl} def
/tinaja01 {(http://www.tinaja.com/tinaja01.html) eurl} def
/info01 {(http://www.tinaja.com/info01.html) eurl} def
/barg01 {(http://www.tinaja.com/barg01.html) eurl} def
/advt01 {(http://www.tinaja.com/advt01.html) eurl} def
/maildon {(mailto:don@.tinaja.com) eurl} def
% button link specific data
/syncat01x {(http://www.tinaja.com/glib/syncat01.pdf) button}
def
/ismm01x {(http://www.tinaja.com/ismm01.html) button} def
/amlink01x {(http://www.tinaja.com/amlink01.html) button} def
/tinaja01x {(http://www.tinaja.com/tinaja01.html) button} def
/info01x {(http://www.tinaja.com/info01.html) button} def
/barg01x {(http://www.tinaja.com/barg01.html) button} def
/advt01x {(http://www.tinaja.com/advt01.html) button} def
/maildonx {(mailto:don@.tinaja.com) button} def
% Main drawing routine:
% =====================
/makemenu {gsave translate save /dosnap exch def
font3 font0
0 0 10 setgrid
% 50 50 showgrid
% uncomment for work grid
/cstretch 0.015 def
/sstretch 0.015 def
/font0 /Revue 1.2 gonzofont
/font1 /StoneSans-Bold 1.3 gonzofont
/kern 0.1 def
0 0 50 22.5 1 roundbox
% main rounded box
gsave aqua 0.33 setgray fill
white font3 %
box header
/cstretch 0.1 def
25 20.5 (|0PLEASE |j|jCLICK |j|jHERE |j|jTO\274 ) cc
/cstretch 0.015 def
0.5 2.2 49 17.3 0.8 roundbox 0.75 setgray fill % inside box fill
black font1
2.3 13.5
(|/syncat01x |1 Get a Synergetics |/surl catalog|/syncat01 ) cl
2.3 10
(|/ismm01x |1 Start your |/surl tech venture|/ismm01 ) cl
2.3 6.5
(|/advt01x |1 Sponsor a display |/surl banner|/advt01 ) cl
2.3 3
(|/info01x |1 Find |/surl research|/info01 solutions) cl
25 13.5
(|/maildonx |1 Send Don Lancaster |/surl email|/maildon ) cl
25 10
(|/barg01x |1 Pick up surplus |/surl bargains|/barg01 ) cl
25 6.5
(|/tinaja01x |1 Find out what a |/surl tinaja|/tinaja01 is) cl
25 3
(|/amlink01x |1 View recommended |/surl books|/amlink01 ) cl
grestore dosnap restore} def
% and actually image it
% =====================
100 100 makemenu showpage