Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Distiller execform not caching in an XObject: why?

Community Beginner ,
Mar 12, 2016 Mar 12, 2016

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

TOPICS
Acrobat SDK and JavaScript
661
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 12, 2016 Mar 12, 2016

‌Have you checked the pdfmark documentation?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 13, 2016 Mar 13, 2016

The code uses many pdfmarks, so I have perused that documentation. But it could be that I have missed something: if you know that there’s something useful in it, please could you be more specific?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 13, 2016 Mar 13, 2016

‌From memory, you can either directly build an Xobject or add keys to one.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 15, 2016 Mar 15, 2016

pdfmark Reference v9.0, page 41: “There are two PostScript idioms that create a Form XObject with Distiller: the execform operator and the BP pdfmark feature.”

The former is the way I want to go, because my PostScript is already written and works on non-Distiller interpreters. Going via the mark … /BP pdfmark route would require that all the PostScript commands be rewritten as text, PDF-style, in a long string. It could be done. But it would be much more natural for execform to work to the full.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2016 Mar 15, 2016
LATEST

I think you're right.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines