%!PS % Some PostScript Transparency Experiments GuruGram #9E % ====================================================== % by Don Lancaster % 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 4.6 % Describes intial attempts and utilities at exploring Acrobat 5 % Transparency using PostScript access of Distiller. % 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. %%%%%%%%%%% links menu directory %%%%%%%%%%%% % 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 % /black cvx 0 /setgray cvx % turn blue marker off % maintextcolor /setrgbcolor cvx % reset to main text color??? /aqua cvx /black cvx /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; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /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 /Link /ANN % annotation type pdfmark % call pdf operators } def /maintextcolor {0 0 0 } def % text link specific data -- use dictionary instead below { /cubic01 {(http://www.tinaja.com/cubic01.asp) eurl} def /hack62 {(http://www.tinaja.com/glib/hack62.pdf) eurl} def /increment {(http://www.tinaja.com/text/bezgen3.html) eurl} def /interpolate {(http://members.bellatlantic.net/~vze2vrva/design.html) eurl } def /bezmath {(http://www.tinaja.com/text/bezmath.html) eurl } def /table {(http://www.tinaja.com/psutils/imtable.psl) eurl } def } pop % dictionary method << %zzzzz %%%% unused links have been commented for gg9a simplicity /maildon (mailto:don@tinaja.com) /tinaja (http://www.tinaja.com) /adobe (http://www.adobe.com) /uncomp (http://www.tinaja.com/plugins/UncompressPDF.api) /ghostscript (http://www.artifex.com/pressreleases/GS70.htm) /flatevue (http://www.tinaja.com/glib/flatevue.pdf) /startsdk (http://www.tinaja.com/glib/startsdk.pdf) /demox.psl (http://www.tinaja.com/glib/g9demox.psl) /demox.pdf (http://www.tinaja.com/glib/g9demox.pdf) /demo.pdf (http://www.tinaja.com/glib/g9demo.pdf) /demoy.psl (http://www.tinaja.com/glib/g9demoy.psl) /demoyx.pdf (http://www.tinaja.com/glib/g9demoyx.pdf) /demoy.pdf (http://www.tinaja.com/glib/g9demoy.pdf) /flatvue (http://www.tinaja.com/glib/flatvue.psl) /pdfrefman (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /psrefman (http://partners.adobe.com/asn/developer/technotes/postscript.html) /pdfmrm (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /tipdf (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /asdk (http://partners.adobe.com/asn/developer/acrosdk) /mtcr (http://support.adobe.com/devsup/devsup.nsf/docs/51864.htm) /flatvue1 (http://www.tinaja.com/psutils/flatvue1.psl) /acrob01 (http://www.tinaja.com/acrob01.asp) /post01 (http://www.tinaja.com/post01.asp) /info01 (http://www.tinaja.com/info01.asp) /gurgrm01 (http://www.tinaja.com/gurgrm01.asp) { /tilley (http://www.tilleyfoundation.com) /mnglobal (http://www.mnglobal.com/energy/pg2.htm) /keely (http://www.keelynet.com) /evolve (http://www.evolvedtechnology.com) /hack64 (http://www.tinaja.com/glib/hack64.pdf) /hackar3 (http://www.tinaja.com/glib/hackar3.pdf) /resbn58 (http://www.tinaja.com/glib/resbn58.pdf) /bppt (http://www.batterypoweronline.com) /muse112 (http://www.tinaja.com/glib/muse112.pdf) /muse113 (http://www.tinaja.com/glib/muse113.pdf) /energfun (http://www.tinaja.com/glib/energfun.pdf) /bashpseu (http://www.tinaja.com/glib/bashpseu.pdf) /adobe (http://www.adobe.com) /netscape (http://www.netscape.com) /gallypsl (http://www.tinaja.com/galley1.psl) /gallypdf (http://www.tinaja.com/galley1.pdf) /atn5150 (http://partners.adobe.com/asn/developer/acrosdk/docs/createpdfapi/pdfmarkReference.pdf) /nutour (http://www.tinaja.com/bargains/nutour02.pdf) /nutoursource (http://www.tinaja.com/bargains/nutour02.psl) /bwhistle (http://www.tinaja.com/glib/bwhistle.pdf) /gonzo1 (http://www.tinaja.com/post01.asp#gonzo) /barg01 (http://www.tinaja.com/barg01.asp) /weblib01 (http://www.tinaja.com/weblib01.asp) /gurgrm01 (http://www.tinaja.com/gurgrm01.asp) /z1 (http://www.tinaja.com/bargains/thumb/albradz2.jpg) /z2 (http://www.tinaja.com/bargains/sbtesteq.asp) /z3 (http://www.tinaja.com/images/bargs/albrad02.jpg) /z4 (http://www.tinaja.com/bargains/thumb/tutenaz2.jpg) /z5 (http://www.tinaja.com/bargains/sbphone.asp) /z6 (http://www.tinaja.com/images/bargs/tutena02.jpg) /sourceme (http://www.tinaja.com/glib/gallery.psl) /sourceme2 (http://www.tinaja.com/glib/autourl.psl) } pop >> {mark exch /eurl cvx ] cvx def} forall %%%%%%%%%%%%%%%% New colorizer patches %%%%%%%%%%%%%%%%%% /boxgrays 0.899 def /grayshade boxgrays def /mastergray boxgrays def /staytint {0.33 setgray} def /staytint1 {0.25 setgray} def /showadgrays true def /red {0 settint} def /Zmacro {staytint /ypos ypos 2 add def 72 300 div setlinewidth xpos ypos moveto txtwide 0 rlineto stroke /ypos ypos -2 add def tintoff} def % hair rule /amacro {(zy0) stringmacro /ypos ypos ypara add def 0.33 setgray } def % start drop cap /bmacro {(iFy1) stringmacro /ypos ypos ypara add def black} def % finish drop cap % Gonzo character colorizer /blueon {mark /blue cvx 0.33 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /blueoff {mark /beige cvx 0 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton {mark 0.33 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1 {mark 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1b {mark beige cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1a {mark /aqua cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1p {mark /burple cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1r {mark /red cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1b {mark /beige cvx % try for beige after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tintoff {mark 0 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def %%%%%%%%%%%%%% COMPACT VERSION OF COLORIZER II %%%%%%%%%%%%%%%%%%%%%% /settint {dup /currenttint exch store 5.999 mul dup floor cvi /&cbar exch store dup floor sub /&cwt exch store [ {/setgray [ /dup cvx 0.3 &cwt 0.59 mul add /ge cvx [1 /exch cvx &cwt 0.59 mul 0.30 add /sub cvx 1 &cwt sub 0.59 mul 0.11 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx /exch cvx ] cvx [ &cwt 0.59 mul 0.3 add /div cvx /dup cvx &cwt /mul cvx 0] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 1 &cwt sub 0.3 mul add /ge cvx [1 &cwt sub 0.3 mul 0.59 add /sub cvx &cwt 0.3 mul 0.11 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx /exch cvx 1 /exch cvx] cvx [1 &cwt sub 0.3 mul 0.59 add /div cvx /dup cvx 1 &cwt sub /mul cvx /exch cvx 0] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 &cwt 0.11 mul add /ge cvx [&cwt 0.11 mul 0.59 add /sub cvx 1 &cwt sub 0.11 mul 0.30 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx 1 /exch cvx] cvx [0 /exch cvx &cwt 0.11 mul 0.59 add /div cvx /dup cvx &cwt /mul cvx] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 1 &cwt sub mul 0.11 add /ge cvx [1 &cwt sub 0.59 mul 0.11 add /sub cvx &cwt 0.59 mul 0.30 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx 1] cvx [0 /exch cvx 1 &cwt sub 0.59 mul 0.11 add /div cvx /dup cvx 1 &cwt sub /mul cvx /exch cvx] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.11 &cwt 0.30 mul add /ge cvx[&cwt 0.30 mul 0.11 add /sub cvx 1 &cwt sub 0.30 mul 0.59 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx /exch cvx 1] cvx [ &cwt 0.30 mul 0.11 add /div cvx /dup cvx &cwt /mul cvx /exch cvx 0 /exch cvx ] cvx /ifelse cvx /setrgbcolor cvx ] cvx /def cvx} {/setgray [ /dup cvx 0.30 1 &cwt sub 0.11 mul add /ge cvx[ 1 /exch cvx 1 &cwt sub 0.11 mul 0.30 add /sub cvx &cwt 0.11 mul 0.59 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx ] cvx [ 1 &cwt sub 0.11 mul 0.30 add /div cvx /dup cvx 1 &cwt sub /mul cvx 0 /exch cvx] cvx /ifelse cvx /setrgbcolor cvx ] cvx /def cvx} ] &cbar get exec exec} bind def /beige {0.10 settint} def % examples of convenience operators /aqua {0.52 settint} def /blue {0.67 settint} def /lime {0.44 settint} def /burple {0.75 settint} def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /guru { gonzo begin ps.util.1 begin printerror nuisance begin} def % guru % activate gonzo utilities 50 50 10 setgrid % create grid % 56 61 showgrid /setpagefonts { /cstretch 0.015 def /sstretch 0.015 def /font0 /StoneSans-Bold 1.6 gonzofont /font1 /StoneSans 0.95 gonzofont /font4 /StoneSans 0.85 gonzofont /font3 /StoneSans-Bold 0.85 gonzofont /font6 /StoneSans-Bold 0.85 gonzofont /font7 /StoneSans-Bold 1.05 gonzofont % subheaders /font8 /StoneSans-Bold [0.65 0 0 0.65 0 0.4] gonzofont /txtwide 36 store /yinc 1.2 store /kern 0.1 store /pm 1.5 store /tabs [7 -2] store aqua 0.33 setgray font1 black font2 /amacro { mark /aqua cvx 0.33 /setgray cvx ] cvx printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch } def /bmacro { mark /black cvx ] cvx printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch } def /shiftin {xpos /xposhold exch store /xpos xpos 3 add store} def /shiftout {/xpos xposhold store} def /texttop 51 store /textleft 3 store /cmacro {aqua 0.25 setgray (znhL7) stringmacro /xpos xpos 1.7 sub store /ypos ypos .1 sub def } def % left title /dmacro {black (pL1hz) stringmacro /xpos xpos 1.7 add store /ypos ypos .1 add def} def % normal text after centered title /fmacro % try and fake | {mark /gsave cvx /currentpoint cvx /moveto cvx 0.1 /setlinewidth cvx 0 0.65 /rlineto cvx /stroke cvx /grestore cvx ] cvx printlist exch 3 index exch put % stuff into gonzo printlist exch 1 add exch % increment gonzo list count } def } def setpagefonts % -2 50.5 (optional header here \274) cl %% Set document opening conventions. Note DOCVIEW limited. [/CropBox [0 0 520 620] % set the wierd size /PAGES pdfmark [ {Catalog} << /ViewerPreferences << /FitWindow true /CenterWindow true >> /PageLayout /OneColumn % continous /Pagemode /UseNone % no thumbs /View [/XYZ null null 1 ] % force 100% >> /PUT pdfmark %%%%%%%%%%%%%%%%% START DEMO ART %%%%%%%%%%%%%%%% %%% Hand patching Info: % next available variable is /GS3 % transparency gstate is object 2 % contents stream is object 18 gets q /GS3 gs (xstuff) Q % be sure to q Q bracket to localize % resources stream is object 19 gets /GS3 2 0 R %%%%% Start FM1 % make a new graphics state [ /_objdef {XGS1} /type /dict /OBJ pdfmark % fill the new overlay graphics state - See PDF manual for details [ {XGS1} << /Type /ExtGState /ca 0.5 % fill transparency is 0.5 /CA 0.5 % stroke transparency is 0.5 /BM /Normal /Name /XGS1 /AIS false /OP false /OPM 1 /op true >> /PUT pdfmark % make a new resources file for an Xobject [ /_objdef {XR1} /type /dict /OBJ pdfmark [ {XR1} << /ProcSet [/PDF ] /ExtGState << /XGS1 {XGS1} >> >> /PUT pdfmark % create a new xobject [ /_objdef {XOBJ1} /type /stream /OBJ pdfmark [ {XOBJ1} << /Type /XObject /Subtype /Form /FormType 1 /Name /XOBJ1 /BBox [0 0 1000 1000] /Resources {XR1} /Matrix [1 0 0 1 0 0] >> /PUT pdfmark [ {XOBJ1} (0 0.5 1 rg /XGS1 gs 4 4 6 6 re f) /PUT pdfmark %%%%%%%% end FM1 /transoverlay { % temp -- replace with new FM1 % start a Begin Picture graphics overlay subroutine... [ /BBox [0 0 1000 1000 ] /_objdef {overlaypix} /BP pdfmark % fill the Begin Picture graphics overlay Xobject subroutine... 0 0.5 1 setrgbcolor % on the aqua side of blue 4 4 6 6 rectfill % complete the Begin Picture graphics overlay Xobject... [ /EP pdfmark } def % Write a two squares program... /twosquares { gsave translate 1 0.5 0 setrgbcolor % red side of orange 2 2 6 6 rectfill % do background opaque box [ {overlaypix} /SP pdfmark % show foreground transparent box grestore} def % Distill the two squares program. Initially use a BARE Distiller Job % Options that has no compression, no embedded fonts, and little else save /snap1 exch store transoverlay % create new objects 14 17.5 twosquares snap1 restore % A postpatch is needed: % 1. USE ONLY A DISTILLER MODE THAT DOES ~NOT~ LINEARIZE % 2. USE ONLY A SEARCH/REPLACE THAT DOES ~NOT~ RESTRICT % 3. Search PDF file for Xobject hits. Find was and wilby. % 4. Change /FM1 link to /XOBJ1 typically 5 0 R to 4 0 R. Depends on Distiller mode. % A search and replace routine is available as http://www.tinaja.com/psutils/searep.psl %%%%%%%%%%%% END DEMO %%%%%%% /tabs [8 16.5] def aqua 0.33 setgray font0 20 47.3 0.7 add (Some PostScript Transparency) cc 20 45.3 0.7 add (Experiments Using Acrobat 5.0) cc black font2 textleft 43 (|3Don Lancaster Synergetics, Box 809, Thatcher, AZ 85552 copyright c2002 as |/surl |6GuruGram|1|/gurgrm01 |6#09-D |/surl http://www.tinaja.com|/tinaja |/surl don@tinaja.com|/maildon (928) 428-4073 |h |a|0W|b|1hat follows is a work in process. I had hoped to be able to show some simple |/surl |6PostScript|1|/post01 utilities that let you explore the transparency features of |/surl |6Acrobat 5|1|/acrob01 . My present solution works, but is horrendously awkward and incomplete. So, I am presenting it here in hopes you can add to it and help solve some key puzzles. |h What we really want is one of these\274 \274 gotten by sending ordinary |/surl |6PostScript|1|/post01 code to |/surl |6Acrobat Distiller|1|/acrob01 . Because PostScript uses an opaque imaging model, only an indirect method will normally work to produce transparent .PDF files. And such transparent .PDF files can only be transformed |/tinton1 |6back|1|/tintoff into PostScript by an ungainly and cumbersome process. Thus .PDF will remain the format of choice for transparency distribution. |h The following documents and tools are essential to understanding transparency\274 |3|/shiftin |h |t|/surl |6PDF Reference Manual|1|/pdfrefman |t|/surl |6PDFMark Reference Manual|1|/pdfmrm |t|/surl |6PostScript Reference Manual|1|/psrefman |t|/surl |6Transparency in PDF|1|/tipdf |t|/surl |6Making a Transparent Color Rectangle|1|/mtcr |t|/surl |6Acrobat SDK Development Kit|1|/asdk |h|1|/shiftout |/aqua |/black Some of these are included in the Acrobat 5 CD disk, while others can be gotten by using the above links. It is especially important to master the |/tinton1 |6COS Objects|1|/tintoff section of the |/tinton1 |6PDFmark Reference Manual|1|/tintoff . ) cl black beige 0.35 setgray 21 -2.5 (|3\320|j1|j\320) cc aqua showpage %%%%%%%%% 222222222 %% start page two 50 50 10 setgrid % create grid setpagefonts /tabs [8 16.5] def textleft texttop (|1I've placed a simple PostScript "transparent square on square" sourcecode as my |/surl |6g9demox.psl|1|/demox.psl ; its interim .PDF file as |/surl |6g9demox.pdf|1|/demox.pdf ; and its final hand altered and fully transparent .PDF file result as |/surl |6g9demo.pdf|1|/demo.pdf Having these three files on hand as printouts will greatly ease understanding what follows. |h It also pays to create a |/tinton1 |6BARE|1|/tintoff Distiller Job Option ahead of time. A "minimal" one that does a 1.4 distill but does |/tinton1 |6not|1|/tintoff do any compression. Or anything else complex such as embedding fonts. Later on and if needed, you can use the |/surl |6FLATVUE.PSL|1|/flatvue utility of |/surl |6GuruGram #8|1|/gurgrm01 to convert any Flate streams to plaintext. |h |c PDF Graphic State Objects |d The .PDF format maintains a |/tinton1 |6graphics state|1|/tintoff that is both open-ended and more complex than PostScript. Besides PostScript's usual |/tinton1 |6setgray|1|/tintoff or its |/tinton1 |6setlinewidth|1|/tintoff and similar operators, new graphics operators can be dictionary defined and passed to Acrobat objects. |h Of crucial interest here is the |/tinton1 |6/CA|1|/tintoff operator used to set the stroke transparency, the |/tinton1 |6/ca|1|/tintoff operator used for the fill transparency, and the |/tinton1 |6/BM|1|/tintoff operator used to pick all of the dozens of super fancy optional transparency mode names. |h Those |/tinton1 |6COS Objects|1|/tintoff are easily used by |/tinton1 |6pdfmark|1|/tintoff to let Distiller create a new graphics state object to be installed in the final transparent .PDF file\274 |3|/shiftin |h|/burple |/staytint1 % make a new graphics state [ /_objdef {newgsstate} /type /dict /OBJ pdfmark |h % fill the new overlay graphics state [ {newgsstate} << /Type /ExtGState /ca 0.5 |t|t% fill transparency is 0.5 /CA 0.5 |t|t% stroke transparency is 0.5 /BM /Normal /AIS false /OP false /OPM 1 /op true >> /PUT |h pdfmark |h|1|/shiftout |/aqua |/black One new graphics state object will be needed for the transparency overlay. Since new graphics operators are cumulative and "remembered", use of bracketing saves and restores as |/tinton1 |6q|1|/tintoff and |/tinton1 |6Q|1|/tintoff will be needed to localize the tranparency to the desired graphics. As was the case on our previous page. |h Note that this only makes a .PDF graphics state object. It does |/tinton1r |6not|1|/tintoff link or install it for use by other objects.|/aqua ) cl black beige 0.35 setgray 21 -2.5 (|3-|j2|j-) cc aqua showpage %% start page three 50 50 10 setgrid % create grid setpagefonts /tabs [16.5] store textleft texttop (|c Xobject Graphic Stream Objects |d |/surl |6Adobe|1|/adobe would like you to use a special type of subroutine called an |/tinton1 |6XObject|1|/tintoff for your transparency graphics. They call these |/tinton1 |6/Group|1|/tintoff objects having new subtype |/tinton1 |6/Transparency|1|/tintoff . But apparently, any old graphics state in the page stream can be forced to take place at any time. Letting you (as we have on page one) go from opaque to transparent and back again in the same page stream. |h I have yet to find any obvious way to create a Group object "subroutine" with PostScript. The closest I've found is the |/tinton1 |6BP|1|/tintoff , short for Begin Picture generator\274 |3|/shiftin |h|/burple |/staytint1 % start a Begin Picture graphics overlay subroutine... [ /BBox [0 0 1000 1000 ] /_objdef {overlaypix} /BP pdfmark |h % fill the Begin Picture graphics overlay Xobject subroutine... 0 0.5 1 setrgbcolor % on the aqua side of blue 4 4 6 6 rectfill |h % complete the Begin Picture graphics overlay Xobject... [ /EP pdfmark |h|1|/shiftout |/aqua |/black Such a Xobject "subroutine" can be shown where desired by\274 |3|/shiftin |h|/burple |/staytint1 [ {overlaypix} /SP pdfmark |h|1|/shiftout |/aqua |/black We now have the ability to create opaque objects, transparent objects, and the graphics states that let you be one or the other. Sadly, I have not yet found out how to make PostScript cause the crucial |/tinton1 |6"Please change to a new graphics state |/tinton1 named zorch"|1|/tintoff that forces distiller to enter a |/tinton1 |6/GS4 gs|1|/tintoff or similar command into the present page stream. While simultaneously listing |/tinton1 |6/GS4 19 0 R|1|/tintoff or wherever as an available resource. |h This may be because I missed the obvious, or that |/surl |6Adobe|1|/adobe omitted or made this capability difficult. Since |/surl |6GhostScript|1|/ghostscript easily forces graphics states, leaving such a fundamental capability off of |/tinton1 |6PostScript|1|/post01 is utterly unthinkable. |h My present sneaky and ungainly workaround instead involves\274 |h |c Force Feeding a Python |d OK, we can now use PostScript to create a .PDF file with all the graphics resources needed for transparency. But apparently do not yet know how to activate the links from the PostScript end. So, (he-he-he), we'll simply |/tinton1 |6post-edit the Acrobat |/tinton1 file|1|/tintoff to force the needed linkings. |h To do this, bring the .PDF file up in Wordpad and save to a new filename. Then snoop around till you find the object number(s) for your new graphic state(s). Then find the object number of the page stream that is to include your transparency change. Then find the object number of the Resources for that page. Write these numbers down. ) cl black beige 0.35 setgray 21 -2.5 (|3-|j3|j-) cc aqua showpage %% start page four 444444 50 50 10 setgrid % create grid setpagefonts /tabs [1.9] store textleft texttop (|1Next, decide how many new graphic state objects you have, and shop around for the lowest |/tinton1 |6unused|1|/tintoff /GS variable names. In our square-on-square demo, |/tinton1 |6/GS2|1|/tintoff is the first available. It is super important to not use the same variable name for two different graphics states! |h To correct the graphics state linkings\274 |/shiftin |h (1) Insert an appropriate new "change transparency" command such |tas |/tinton1 |6/GS2 gs|1|/tintoff into |jthe correct place in the page stream. |h (2) Insert an appropriate "link graphics state" command such as |t|/tinton1 |6/GS2 19 0 R|1|/tintoff into the correct place in the resources dictionary. |tThe second number is the desired graphics state object. |h (3) Save the new file and bring it up in Acrobat to auto-rebuild |tthe cross reference and byte count. Then do a |/tinton1 |6save as|1|/tintoff to |tpreserve the repairs as your final file. |h|1|/shiftout |/aqua |/black Should you need more than one linking, repeat the above process as needed. In the |/surl |6g9demox.psl|1|/demox.psl example, a |/tinton1 |6/GS2 gs|1|/tintoff will go into stream Object #2 , and a |/tinton1 |6/GS2 1 0 R|1|/tintoff goes into Resource Object #8. The new graphics state is Object #1. |h |c Failed attempts at linking\274 |d There is an obvious |/tinton1 |6/PUT|1|/tintoff command available to the |/tinton1 |6pdfmark|1|/tintoff operator, but I seem unable to get it to do anything useful in the way of linking resources.. |h Ferinstance, the command string\274 |3|/shiftin |h|/burple |/staytint1 [{ThisPage} <> >> >> /PUT pdfmark |h|1|/shiftout |/aqua |/black \274 seems to create a |/tinton1 |6new|1|/tintoff and |/tinton1 |6duplicate(!)|1|/tintoff Resources entry that is ignored by Acrobat. Same goes for |/tinton1 |6{NextPage}|1|/tintoff . And, while |/tinton1 |6{Catalog}|1|/tintoff seems to enter just fine, this appears to be out of the resource inheritibility parentage range. |3|/shiftin |h|/burple |/staytint1 < insert many frustrating lost hours here > |h|1|/shiftout |/aqua |/black I did manage to find an alternate method that is pretty nigh but not plumb. While somewhat more complex, it lets you actually create any XObject you like, but still demands a simple (often changing only one byte) post patch. I call it\274 |c The Bait and Switch Method |d A PDF stream object apparently consists of a data fork (the actual stream) and a resource fork (a companion dictionary). You can use pdfmark's |/tinton1 |6/PUT|1|/tintoff command to ) cl black beige 0.35 setgray 21 -2.5 (|3-|j4|j-) cc aqua showpage %% start page five 55555 50 50 10 setgrid % create grid setpagefonts /tabs [1.9] store textleft texttop (|1enter either stream or dictinary items. So long as you do only one or the other with any single |/tinton1 |6/PUT|1|/tintoff command. Let's try it. |h You have to work from the inside out. First, create a transparent graphics state pretty much like we did before\274 |3|/shiftin |h|/burple |/staytint1 [ /_objdef {XGS1} /type /dict /OBJ pdfmark |h [ {XGS1} << /Type /ExtGState /ca 0.5 % fill transparency is 0.5 /CA 0.5 % stroke transparency is 0.5 /BM /Normal /Name /XGS1 /AIS false /OP false /OPM 1 /op true >> /PUT pdfmark |h|1|/shiftout |/aqua |/black Next, create a resource dictionary object for your Xobject\274 |3|/shiftin |h|/burple |/staytint1 [ /_objdef {XR1} /type /dict /OBJ pdfmark |h [ {XR1} << /ProcSet [/PDF ] /ExtGState << /XGS1 {XGS1} >> >> /PUT pdfmark |h|1|/shiftout |/aqua |/black And then create your actual Xobject, starting with its dictionary\274 |3|/shiftin |h|/burple |/staytint1 [ /_objdef {XOBJ1} /type /stream /OBJ pdfmark |h [ {XOBJ1} << /Type /XObject /Subtype /Form /FormType 1 /Name /XOBJ1 /BBox [0 0 1000 1000] /Resources {XR1} /Matrix [1 0 0 1 0 0] >> /PUT pdfmark |h|1|/shiftout |/aqua |/black Note that Distiller has used an internal name of |/tinton1 |6{XGS1}|1|/tintoff to link the Resource Dictionary to the graphics state. And |/tinton1 |6{XR1}|1|/tintoff to link the Xobject to its Resource Dictionary. Note further that these variables are internal and local to Distiller only. |h We then add the stream to our new Xobject\274 ) cl black beige 0.35 setgray 21 -2.5 (|3-|j5|j-) cc aqua showpage %% start page six 6666 50 50 10 setgrid % create grid setpagefonts /tabs [1.9 16] store textleft texttop (|3|/shiftin |h|/burple |/staytint1 [ {XOBJ1} (0 0.5 1 rg /XGS1 gs 4 4 6 6 re f) /PUT pdfmark |h|1|/shiftout |/aqua |/black Sadly, there are apparently still two big gotchas here. The first is that |/tinton1 |6you have to |/tinton1 enter your stream data as PDF commands rather than PostScript|1|/tintoff . Ferinstance, a |/tinton1 |64 4 6 6 rectfill|1|/tintoff becomes |/tinton1 |64 4 6 6 re|1|/tintoff . |h If your PostScript is too complex to sight convert, try doing another |4PDF|1 whose sole goal is to convert the code for you. The big advantage of this method is that you can in fact create and link graphic states to both your XObject and its stream any way you like. And transparency groups become possible. |h The second infuriating gotcha is that I found no way to do a\274 |3|/shiftin |h|/burple |/staytint1 [ {XOBJ1} /SP pdfmark |h|1|/shiftout |/aqua |/black \274using |/tinton1 |6/SP|1|/tintoff to enter your new XObject. Despite the Xobject and its Resource file done via |/tinton1 |6/BP|1|/tintoff and |/tinton1 |6/EP|1|/tintoff begin and end picture looking nearly identical to me. I am thoroughly puzzled over this apparent restriction. Chances are there is an internal picture name directory in Distiller I have not yet found. |h So, to continue, you create a regular and temporary external form object the old |/tinton1 |6/BP|1|/tintoff and |/tinton1 |6/EP|1|/tintoff way. Just like we did earlier\274 |3|/shiftin |h|/burple |/staytint1 [ /BBox [0 0 1000 1000 ] /_objdef {tempoverlay} /BP pdfmark |h 0 0.5 1 setrgbcolor |t|t% on the aqua side of blue 4 4 6 6 rectfill |t|t% new square temporarily opaque |h [ /EP pdfmark |h|1|/shiftout |/aqua |/black When |/tinton1 |6/SP|1|/tintoff gets called and distilled, a form object usually named |/tinton1 |6/FM1|1|/tintoff gets created. The only tiny remaining problem is that the form resources are pointing to the wrong and opaque Xobject. We can finally do our "bait and switch" by post patching. |h Post Patching is done simply by inspecting the file and finding the names of the wanted and unwanted transparency Xobjects. The patch itself is usually as easy as changing |/tinton1 |6/FM1 4 |k0 obj|1|/tintoff to |/tinton1 |6/FM1 3 0 obj|1|/tintoff . Normally |/tinton1 |6no xref rebuild should be |/tinton1 needed|1|/tintoff , so long as the old and new object numbers have the same number of digits. Be sure to watch this detail. |h Thus, our post patch still remains but is much simpler and safer than before. New example code for you to inspect and use appears as |/surl |6g9demoy.psl|1|/demoy.psl ; its intermediate .PDF file as |/surl |6g9demoyx.pdf|1|/demoyx.pdf ; and its final hand altered and fully transparent .PDF file result as |/surl |6g9demoy.pdf|1|/demoy.pdf . ) cl black beige 0.35 setgray 21 -2.5 (|3-|j6|j-) cc aqua showpage %% start page six 6666 50 50 10 setgrid % create grid setpagefonts /tabs [1.9 16] store textleft texttop (|c A Few More Gotchas |d Using Wordpad for post editing can be dangerous as it may trash an occasional control command character in a font or other compressed stream. Word itself is often acceptably better, but your best bet is to do a true PDF document search and replace that has no excluded characters and makes no changes in line ending terminations. A custom |/surl |6PostScript-as-language|1|/post01 routine can easily handle this. As could a |/surl |6custom plugin|1|/startsdk . |h While you can apparently add any dictionary item or append any stream content to your external Xobject at any time, apparently the Xobjects created internally by the |/tinton1 |6/BP|1|/tintoff and |/tinton1 |6/EP|1|/tintoff process will |/tinton1 |6not|1|/tintoff let you append stream content. But they will let you add less useful dictionary items. Note once again that |/tinton1 |6/PUT|1|/tintoff will create a duplicate and useless dictionary entry instead of overwriting an existing one. |h PDFmark defined streams are apparently forced into Flate Decoding whether you like it or not. If needed, you can uncompress these using |/surl |6FLATEVUE.PDF|1|/flatevue or with the |/surl |6SDK Uncompress plugin|1|/startsdk . Note that the later infuriatingly "erases" anything not yet correctly linked. |h Adobe does |/tinton1 |6not|1|/tintoff want you to make graphics state changes inside an Xobject. Since our example internally forces an internal Xobject transparency state change, certain post PDF plugins might not work as they may get overridden. Specifically, the |/surl |6UncompressPDF|1|/uncomp in the |/surl |6Acrobat SDK|1|/startsdk apparently will not let you change the transparency of the blue box on page one. |c How Many Mathematicians Does it Take\274 |d \274 to change a light bulb? Only one, who hands the bulb to four Californians. Thus reducing the problem to a previously solved riddle. |h We thus now have a method to explore and actually use Acrobat transparency by using distilled PostScript. It works just fine but needs an annoying hand patch at end process. To make the solution general and convenient, your help is needed in solving the (apparently) simpler problem of using PostScript to force a graphics change and autolink in Distiller. |h As of this latest |/surl |6GuruGram|1|/gurgrm01 update, we have full PostScript transparency via Distiller, but still require a one byte, non index trashing post patch. The remaining problem boils down to "How do I feed the |/tinton1 |6/SP|1|/tintoff pdfmark command in Distiller my own named Xobject that was not created by |/tinton1 |6/BP|1|/tintoff and |/tinton1 |6/EP|1|/tintoff ?" |h Let's hear from you. |h Consulting services available per |/surl |6http://www.tinaja.com/info01.asp|1|/info01 . ) cl black beige 0.35 setgray 21 -2.5 (|3-|j7|j-) cc aqua showpage %%%%%%%%%%%%%%%%%%%% % EOF