[QUESTION] Is this an OOo bug when creating PostScript printfiles?

Helge Blischke h.blischke at srz.de
Fri Sep 7 12:10:38 PDT 2007


Kurt Pfeifle wrote:
> Kurt Pfeifle wrote:
> 
>>I was too quick, and therefor wrong.
>>
>>Kurt Pfeifle wrote:
>>
>>>Kurt Pfeifle wrote:
>>>
>>>
>>>>>%%BeginSetup
>>>>
>>>>[....]
>>>>
>>>>>%%IncludeFeature: *PageSize A4
>>>>>} stopped cleartomark
>>>>>%%IncludeFeature: *InputSlot Tray3
>>>>>} stopped cleartomark
>>>>>%%EndSetup
>>>>
>>>>[....]
>>>>
>>>>
>>>>>%%Page: 2 2
>>>>>%%PageBoundingBox: 12 12 583 830
>>>>>%%BeginPageSetup
>>>>>%%IncludeFeature: *InputSlot Tray4
>>>>>} stopped cleartomark
>>>>>%%EndPageSetup
>>>>
>>>>[....]
>>>>
>>>>
>>>>>As far as I'm able to read PS, I can see that the actual PS file 
>>>>>contains the tray switching instructions, 
>>>>
>>>>Yes.
>>>
>>>Uhmmm.... actually, no. It does *not* contain valid code to switch
>>>the trays, AFAICS. It pretends to, but it doesn't work like that.
>>>
>>>It contains "empty" code only. It should look similar to this:
>>>
>>>  %%BeginSetup
>>>  [....]
>>>  %%IncludeFeature: *PageRegion A4
>>>  << /PageSize A4 [595 842] /ImageBBox null >> setpagedevice
>>>  } stopped cleartomark
>>>  %%IncludeFeature: *InputSlot Tray3
>>>  << /MediaPosition 3 >> setpagedevice
>>>  } stopped cleartomark
>>>  %%EndSetup
>>>
>>>  [....]
>>>
>>>  %%Page: 2 2
>>>  %%PageBoundingBox: 12 12 583 830
>>>  %%BeginPageSetup
>>>  %%IncludeFeature: *InputSlot Tray4
>>>  << /MediaPosition 4 >> setpagedevice
>>>  } stopped cleartomark
>>>  %%EndPageSetup
>>
>>
>>This example should have been (with "BeginFeature" instead of
>>"IncludeFeature"):
>>
>>   %%BeginSetup
>>   [....]
>>   [{
>>   %%BeginFeature: *PageRegion A4
>>   << /PageSize A4 [595 842] /ImageBBox null >> setpagedevice
>>   %%EndFeature
>>   } stopped cleartomark
>>   [{
>>   %%BeginFeature: *InputSlot Tray3
>>   << /MediaPosition 3 >> setpagedevice
>>   %%EndFeature
>>   } stopped cleartomark
>>   %%EndSetup
>>
>>   [....]
>>
>>   %%Page: 2 2
>>   %%PageBoundingBox: 12 12 583 830
>>   %%BeginPageSetup
>>   [{
>>   %%BeginFeature: *InputSlot Tray4
>>   << /MediaPosition 4 >> setpagedevice
>>   %%EndFeature
>>   } stopped cleartomark
>>   %%EndPageSetup
>>
>>
>>In my haste, I overlooked that OOo uses the '%%IncludeFeature:' comment
>>and not the '%%Begin(End)Feature:' one.
>>
>>As such, '%%IncludeFeature:' is valid and works.... *IF* all to-be-in-
>>cluded features *were* listed in the %%Prolog section of the PS file.
>>But they aren't. Therefor, nothing is 'included'.
>>
>>There are 3 ways it could work:
>>
>> (a) Inside the "%%BeginProlog ... %%EndProlog" section, have valid
>>     definitions of all the device features including the PS/device
>>     code to be inserted. Then, in the "%%BeginPageSetup: ...
>>     %%EndPageSetup" sections it is enough to use a 1-line
>>     "%%InsertFeature: *InputSlot TrayXYZ" (where the string
>>     "*InputSlot TrayXYZ" must match the previous definition).
>>
>> (b) Just put the "%%InsertFeature: *InputSlot TrayXYZ" lines into the
>>     document, and expect the "document manager" to handle it by
>>     looking up the PPD and insert the correct PS snippet into
>>     the file. This is how OOo expects it ... however, CUPS is not
>>     a document manager that does do this.
>>
>> (c) Or, inside the "%%BeginPageSetup: ... %%EndPageSetup:" section
>>     use a multiline "%%BeginFeature: ....(PS Code here) %%EndFeature
>>     } stopped cleartomark" subsection.
>>
>>
>>(c) is the most robust, IMHO, because it would make OOo printfiles w
>>work as expected on the target printer, even in the absence of a
>>"document manager".
>>
>>It is up to Mike to comment on his plans for CUPS to support the
>>'%%InsertFeature:' statements of PostScript files.
>>
> 
> 
> 
> I had a chance to look a little closer now, using a real life OOo 2.2
> on Linux and see what its PostScript output is.
> 
> OOo indeed does emit this type of code for each page, when the tray
> selection feature is enabled in the respective page style:
> 
>   %%Page: 2 2
>   %%PageBoundingBox: 12 12 583 830
>   %%BeginPageSetup
>   %
>   [{
>   %%IncludeFeature: *InputSlot 2Tray
>   } stopped cleartomark
>   %%EndPageSetup
> 
> I'm not sure if using '%%IncludeFeature:' is "legal" DSC if the feature
> is for "InputSlot".
> 
> The DSC spec from Adobe says (paraphrasing):
> 
>   "if the %%IncludeFeature: comment is used, there must be an
>    additional %%DocumentMedia: or a %%Requirements: comment in
>    the header of the document."
> 
> However, OOo does not write either additional comment into the
> header of the document.
> 
> =====================================================================
>   Question to our resident PostScript gurus: is this an OOo bug?
> =====================================================================
> 
> 

Yes, it certainly is. The OOo folks should put the slot selection
at the end of the global setup section (or repeat it in the page setup
for *every* page. But, as the setpagedevice operator has a lot of
side effects like executing an initgraphics etc., in this case any
pagecounting by BeginPage and/or AndPage procedures and related
stuff would not work).

Look at the links on the CUPS web site, there is a filter named oopstops
which sanitizes the PS output of OOo 2.x (and presumably 1.x, but
I haven't tested that) suitable for CUPS' pstops filter.

Helge



-- 
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom

H.Blischke at acm.org




More information about the cups mailing list