Distiller execform not caching in an XObject: why?
This is a technical question about the internal operation of Distiller.
I have a PostScript program. If you care, it’s at www.jdawiseman.com/placemat.html but don’t look, as it’s 12½k lines long with hundreds of parameters and settings.
It paints some complicated things, which are to be painted identically on multiple pages. These are wrapped in a PostScript form, so that they distil into a PDF XObject. Having just one copy of the XObject shrinks the size of the PDF, and can speed its rasterisation.
So the PostScript has the likes of /ExampleForm << /FormType 1 /BBox [ … … … … ] /Matrix matrix identmatrix /PaintProc {pop …} >> def, which is then invoked with ExampleForm execform. It works, in the sense that stuff is correctly painted. Omitting any of these parameters causes it to fail. So it it really seems that execform is being called correctly.
But only sometimes does Distiller make an XObject. At the PostScript level sometimes Distiller just re-executes the PaintProc every time, or just sometimes. (And doesn’t add an /Implementation item to the dictionary.) My experiments have failed to establish bright rules about when Distiller creates an XObject.
It is worth noting PLRM3 p209: “Form caching is most effective when the graphics state does not change between successive invocations of execform for a given form. Changes to the translation components of the CTM usually do not influence caching behavior; other changes may require the interpreter to reexecute the PaintProc procedure.”
So:
• Is there any parameter or setting or trick that can encourage or force Distiller to create an XObject every time, and to refer to it?
• Failing that, under what circumstances does Distiller do so, so that I can try to make those circumstances happen?
• Is the graphics deemed to change if the transformation matrix is changed, then changed back? Perhaps with with gsave … grestore; perhaps with matrix currentmatrix … setmatrix?
• It would be easier to disentangle what Distiller has been doing if the XObjects had names other than Fm1, Fm2, etc. Adding a /Name to the form dictionary doesn’t do that: is it possible within the PostScript?
Thank you.
A similar question was asked at
http://groups.google.com/forum/#!topic/comp.lang.postscript/eCJtjeESlPk
