[cups.general] pstops and DSC conformance
Helge Blischke
h.blischke at acm.org
Tue Nov 3 06:18:26 PST 2009
Tim Waugh wrote:
> Hi,
>
> I'm investigating a bug report about the pstops filter when used with
> the 'number-up=2' option. The troublesome document is created by
> enscript, which does this sort of thing:
>
> %%Page: (1) 1
> %%BeginPageSetup
> /_s save def
> ...
> %%EndPageSetup
> ...
> _s restore
> gsave
> showpage
> grestore
> %%Page: (2) 2
> %%BeginPageSetup
> /_s save def
> ...
> %%EndPageSetup
> ...
> _s restore
> gsave
> showpage
> grestore
>
>
> This leads to problems because pstops puts its own definitions at the
> end of the PageSetup section, like this:
>
> %%BeginProlog
> userdict/ESPshowpage/showpage load put
> userdict/showpage{}put
> %%EndProlog
> %%Page: (1) 1
> %%BeginPageSetup
> /_s save def
> ...
> userdict/ESPsave save put
> ...
> %%EndPageSetup
> ...
> _s restore %%%% ARGH, this undoes the ESPsave definition!
> gsave
> showpage
> grestore
> userdict/ESPsave get restore
> /s save def
> ...
> userdict/ESPsave save put
> _s restore
> gsave
> showpage
> grestore
> userdict/ESPsave get restore
>
> Because of the 'save/restore' bits already in there, the previous
> definition of ESPsave is undone before it is used.
>
> Is this sort of thing allowed in a DSC-conformant document? I imagine
> it can't be, but I can't find any definitive in my searching.
>
> The actual bug report is here:
> https://bugzilla.redhat.com/show_bug.cgi?id=532516
>
> Tim.
> */
The save / restore stuff inserted by the pstops filter semantically is meant
to bracket the original contents of the page (short of the final showpage,
of course). As far as I see it , it would be safe for the pstops filter to
insert the "userdict/ESPsave save put" at the very begining of the page
setup section (preceding the stuff already present).
By the way, from your sneppets I cannot determine what the excript generated
save / restore brackets are good for (perhaps you could post a sample file
to do more investigations).
Helge
More information about the cups
mailing list