[cups.development] cups filter Xpdf/pdftops seems to produce

Helge Blischke h.blischke at srz.de
Mon Jan 17 06:45:13 PST 2005


Michael Sweet wrote:
> 
> Helge Blischke wrote:
> > hans lux wrote:
> >
> >>Helge Blischke wrote:
> >>
> >>
> >>>hans lux wrote:
> >>>
> >>>
> >>>
> >>>>hi there,
> >>>>
> >>>>i downloaded and compiled the latest cups version 1.2.x.
> >>>>i was actually only interested in the pdftops filter.
> >>>>
> >>>>when applying the filter to an arbitrary pdf file
> >>>>like
> >>>>
> >>>>./pdftops 1 2 3 4 5 foo.pdf > out.ps
> >>>>
> >>>>and sending it to the printer,
> >>>>i get the following error:
> >>>>
> >>>>ERROR: VMerror
> >>>>OFFENDING COMMAND: pdfSetup
> >>>>
> >>>>STACK:
> >>>>
> >>>>and that's it.
> >>>>
> >>>>note: this error doesn't occur when i apply pdftops in version 2.01 and 2.03
> >>>>and not in the command line version that comes mit Xpdf.
> >>>>
> >>>>can anyone attest this error ?
> >>>>
> >>>>hlux
> >>>>
> >>>>
> >>>
> >>>Post (an URL to) a sample PostScript file that produces this error.
> >>>
> >>>Helge
> >>>
> >>>
> >>>
> >>
> >>here you go
> >>
> >>http://www.metawire.org/~c42/cups/
> >
> >
> > The filter (pdftops300) seems to be broken. Near the beginning of the PS
> > file,
> > there is the code:
> > ---snip---
> > /pdfSetup {
> >   3 1 roll 2 array astore
> >   /setpagedevice where {
> >   pop pop pop
> > } def
> > ---snip---
> > which is definitely bogus.
> > It will produce PostScript errors in an unpredictable way (depending on
> > how the
> > PS interpreter's scanner does read ahead etc.).
> >
> > It should read instead:
> > ---snip---
> > /pdfSetup {
> >   3 1 roll 2 array astore
> >   /setpagedevice where {
> >     pop 3 dict begin
> >       /PageSize exch def
> >       /ImagingBBox null def
> >       /Policies 1 dict dup begin /PageSize 3 def end def
> >       { /Duplex true def } if
> >     currentdict end setpagedevice
> >   } {
> >     pop pop
> >   } ifelse
> > } def
> > ---snip---
> > (which is produced by the original pdftops utility from the Xpdf suite).
> 
> Actually, no, we don't want the setpagedevice commands there, we
> want to eliminate this pdfSetup stuff entirely since the commands
> are printer-specific.
> 
> Looks like I missed a few lines, it should just be:
> 
>      /pdfSetup {
>        pop pop pop
>      } def
> 
> --

Yes, but then you'd have to interprete either the DocumentMedia or the
BoundingBox
comment to get the media size set up in the PDF file (it is determined
by the crop box,
if present, or the media box otherwise, if I remember correctly).
It sould be sufficient to remove the duplex stuff from that procedure as
that has no
counterpart in the PDF file itself.

Helge


-- 
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom
http://www.srz.de
tel: +49 30 75301-360




More information about the cups mailing list