%!PS % Converting a JPEG file into a click-returnable PDF file % ======================================================= % by Don Lancaster /ggnum 23 store % Copyright c 2002 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % Linking welcome. Reposting expressly forbidden. % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.1 % Clicking out of a .PDF file from within a browser usually will return you to % the START of the .pdf file rather than the page you left it. This utility shows % how to convert a .jpeg file used for photo expansion into a click-returned .PDF % file that goes back to the proper place in the original .PDF file. % Note that the distiller default sizes set the MAXIMUM clip area. Be sure to % expand these for larger images! % IMPORTANT NOTE: Don Lancaster's file gonzo.ps is required for this program. % After obvious location mods, uncomment ONE of the following two lines: (C:\\windows\\desktop\\gonzo\\gonzo.ps) run % use internal gonzo % (A:\\gonzo.ps) run % use external gonzo % NOTE THAT ALL PS FILENAME STRINGS !!!DEMAND!!! DOUBLE REVERSE SLASHES. % GONZO20A Guru Gonzo PostScript power tools (Interim release) % Includes gonzo justification and layout utilities. % Copyright c 1990, 1996, 2001 by Don Lancaster and Synergetics, Box 809, % Thatcher Arizona, 5552 (928) 428-4073 don@tinaja.com support % via http://www.tinaja.com All commercial rights and all electronic % media rights **FULLY** reserved. Reposting is expressly forbidden. %%%%%%%%%%%%%%%%%%%%%%%%% HOST PDF DESTINATION MARKING %%%%%%%%%%%%%%%%%%%%% % There are two parts to the JPEG capture and return linking process. % First the host PDF files have to have their return pages suitably marked... % Copy, uncomment and insert similar code into your host PDF file to be returned to. % Change return page numbers and destinations as needed... %%%%%%%%%%%%%%%%%%%%%%%%%% TARGET JPEG CAPTURES %%%%%%%%%%%%%%%%%%%%%%%%%%% % ... and then the individual JPEG files have to be captured as PDF and overlain % with a suitable clickable return box. % This example batch processes four files. Later split and renamed using Acrobat. % combined jpeg conversion and return box: % IE apparently will not accept a PDF file returning to an internal location on a second % PDF file, instead returning a blank page. An indirect HTML redirect is a % one sledgehammer workaround... /grabfigure1 {save /af1 exch store 0 0 923 526 1 [15 12 80 40 ] % xpos ypos xres yres pixscal boxdetail (C:\\windows\\desktop\\aaraw_pix\\flu84501.jpg) % source foto (http://www.tinaja.com/images/bargs/iefix001.html) % then return grabjpeg1 af1 restore} store /grabfigure2 {save /af1 exch store 0 0 790 672 1 [15 12 80 40 ] % xpos ypos xres yres pixscal boxdetail (C:\\windows\\desktop\\aaraw_pix\\tek40841.jpg) % source foto (http://www.tinaja.com/images/bargs/iefix002.html) % then return grabjpeg1 af1 restore} store /grabfigure3 {save /af1 exch store 0 0 530 816 1 [15 12 80 40 ] % xpos ypos xres yres pixscal boxdetail (C:\\windows\\desktop\\aaraw_pix\\sencri01.jpg) % source foto (http://www.tinaja.com/images/bargs/iefix003.html) % then return grabjpeg1 af1 restore} store /grabfigure4 {save /af1 exch store 0 0 422 612 1 [15 12 80 40 ] % xpos ypos xres yres pixscal boxdetail (C:\\windows\\desktop\\aaraw_pix\\abspar01.jpg) % source foto (http://www.tinaja.com/images/bargs/iefix004.html) % then return grabjpeg1 af1 restore} store % apparently the default distiller size sets a limit /grabjpeg1 { save /snap2 exch def /returnurl exch store % grab return url /infilename exch store % grab passed pix file /boxdetail exch store /photoscale exch store /vpixels exch store /hpixels exch store translate % adjust position for final figure ??? [/CropBox [0 0 hpixels vpixels] % set the wierd size one page only /PAGE pdfmark /DeviceRGB setcolorspace % pick color model 0 0 translate % set page position gsave hpixels vpixels scale % magnify unit square photoscale dup scale /infile infilename (r) file def % establish input read file /Data {infile /DCTDecode filter} def % define a data source << % start image dicationary /ImageType 1 % always one /Width hpixels % JPEG width in pixels /Height vpixels % JPEG height in pixels /ImageMatrix [hpixels 0 0 vpixels neg 0 vpixels ] /DataSource Data % proc to get filtered JPEG /BitsPerComponent 8 % color resolution /Decode [0 1 0 1 0 1] % per red book 4.10 >> image % call the image operator grestore makereturnbox ypos snap2 restore /ypos exch def } def /makereturnbox { % for auto include routine gsave /font0 /StoneSans-Bold 11 gonzofont /yinc 13 store boxdetail aload pop /bwy exch store /bwx exch store /bsy exch store /bsx exch store bsx bsy translate 0 0 mt bwy pu bwx pr bwy pd closepath gsave 0.8 0.8 0.8 setrgbcolor fill grestore 0.4 0.4 0.4 setrgbcolor 4 setlinewidth 1 setlinecap 1 setlinejoin stroke bwx 2 div 23 (Click here\nto return) cc mark % start pdfmark /Rect [ 0 0 bwx bwy ] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /Subtype /Link /ANN % annotation type pdfmark % call pdf operators grestore } def %%% demo -- remove or alter before reuse grabfigure1 showpage grabfigure2 showpage grabfigure3 showpage grabfigure4 % EOF