%!PS-Adobe-3.1 % Copyright c 2019, 2022 by Don Lancaster & Synergetics, Box 640, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available. % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 10a. % A demo of PostScript pre Distiller nav generation! %%////// Extracted Gonzo Utilities ////// /webtintmat [ 0 1 5 { /a exch store 0 1 5 { /b exch store 0 1 5 { 5 div b 5 div a 5 div } for } for } for ] def % setwebtint accepts a color number 0 to 215 and then % sets the PostScript color generator for later use... /setwebtint { abs cvi 216 cvi mod % restrict range webtintmat exch 3 mul 3 getinterval % get values from table aload pop setrgbcolor} def % and set them /setgrid { /blocksize exch def translate % simplified blocksize dup scale} def /gonzofont {dup type cvlit /arraytype eq {exch findfont exch makefont} {exch findfont exch scalefont} ifelse setfont mark /spacewidth ( ) stringwidth pop /cstretch cvx /add cvx /sstretch cvx /add cvx /def cvx currentfont dup backcdict exch (F?) dup 1 14 index (xxxxx) cvs 4 get put put /setfont cvx ] cvx def} def 50 dict /backcdict exch def /cstretch 0 store /sstretch 0 store /mt {moveto} store /pd {0 exch neg rl} def /pr { 0 rl} def /pu {0 exch rl} def /pl {neg 0 rl} def /rl {rlineto} def /line2 {.12 dup setlinewidth 5 mul /erase exch def} def %%%%%%%%%%%% end gonzo excerpts %%%%%%%% %%%%%%%%%%%% pagenav code starts here /pagenum 0 store % These draw the boxes /baux { save /ssnap exch store /sym exch store translate 0 0 mt 2 pu 2 pr 2 pd closepath gsave 172 setwebtint fill grestore 129 setwebtint line2 stroke 196 setwebtint /font2 /StoneSans-Bold 1.3 gonzofont font2 1 sym stringwidth pop 2 div sub 0.7 % fake cj mt sym show ssnap restore} store 0 setwebtint /glyphone {navvposn (<<) baux} store /glyphprev {navvposn (<) baux } store /glyphnext {navvposn(>) baux } store /glyphlast {navvposn(>>) baux} store % These link the boxes /aaaa { % for pagr 1 [ /Rect [0 74 2 76] /Page/Next /View [/XYZ null null null] /Border [0 0 0 ] /Subtype /Link /ANN pdfmark numpagesknown {[ /Rect [2.5 74 4.5 76] /Page lastpagenum /View [/XYZ null null null] /Border [0 0 0 ] /Subtype /Link /ANN pdfmark} if } store /bbbb { % for all intermediate pates [ /Rect [0 74 2 76] /Page 1 /View [/XYZ null null null]/Border [0 0 0 ] /Subtype /Link /ANN pdfmark [ /Rect [2.5 74 4.5 76] /Page /Prev /View [/XYZ null null null] /Border [0 0 0 ] /Subtype /Link /ANN pdfmark [ /Rect [5 74 7 76] /Page /Next /View [/XYZ null null null] /Border [0 0 0 ] /Subtype /Link /ANN pdfmark numpagesknown { [ /Rect [7.5 74 9.5 76] /Page lastpagenum /View [/XYZ null null null]/Border [0 0 0 ] /Subtype /Link /ANN pdfmark } if } store /cccc { % for last page [ /Rect [0 74 2 76] /Page 1 /View [/XYZ null null null] /Border [0 0 0 ] /Subtype /Link /ANN pdfmark [ /Rect [2.5 74 4.5 76] /Page /Prev /View [/XYZ null null null] /Border [0 0 0 ] /Subtype /Link /ANN pdfmark numpagesknown { [ /Rect [5 74 7 76] /Page lastpagenum /View [/XYZ null null null] /Border [0 0 0 ] /Subtype /Link /ANN pdfmark} if } store /addpagenav {gsave 3 0 translate navpagenum 1 eq { 0 glyphnext numpagesknown {2.5 glyphlast} if aaaa} if navpagenum 1 ne lastpage not and {0 glyphone 2.5 glyphprev 5 glyphnext 7.5 glyphlast bbbb} if lastpage {0 glyphone 2.5 glyphprev cccc} if /prevpage pagenum store /navpagenum navpagenum 1 add store grestore} store /guesspages { 4 % insert number of pages here dup 4 ge { /lastpagenum exch store /numpagesknown true store} { pop numpagesknown false store} ifelse }store /imagearray length 40 store guesspages %%%%%%%%%%%%% generate demo %%%%%%%%% /navpagenum 1 store /navvposn 74 store /lastpage false store % set narrow cropbox... [/CropBox [0 0 325 792] % set phone size cropbox /PAGES pdfmark /font1 /StoneSans-Bold 0.85 gonzofont % may want to change this font1 1 20 10 setgrid addpagenav 5 60 mt (page one) show showpage 1 20 10 setgrid addpagenav 5 60 mt (page two) show showpage 1 20 10 setgrid addpagenav 5 60 mt (page three) show showpage 1 20 10 setgrid /lastpage true store addpagenav 5 60 mt (page four and last) show showpage %EOF