ps2ps is adding BS to the end of my jobs...

Helge Blischke h.blischke at srz.de
Sat Oct 15 06:45:31 PDT 2005


Brad Langhorst wrote:
> 
> Helge Blischke wrote:
> > Brad Langhorst wrote:
> >
> >>Michael Sweet wrote:
> >>
> >>>Brad Langhorst wrote:
> >>>
> >>>
> >>>>I'm running jobs from windows clients through cups' pstops to strip
> >>>>out color information.
> >>>>
> >>>>
> >>>>...
> >>>>ehsave restore^M
> >>>>(%%[LastPage]%%) = ^M
> >>>>%%EOF^M
> >>>>^Duserdict/ESPwl{}bind put
> >>>>
> >>>>%%Trailer
> >>>>%%Pages: 0
> >>>>%%EOF
> >>>>^D
> >>>>
> >>>>
> >>>>note that cups has added a second EOF and ctrl-D
> >>>>I think it's not correct to add information after a ctrl D
> >>>>
> >>>>this is causing my printer to barf...(rightly so i think...)
> >>>>
> >>>>what can i do to fix the problem?
> >>>
> >>>
> >>>Stop using Foomatic.
> >>>
> >>
> >>Sorry to be thick... I don't see where foomatic is involved. Samba
> >>spools the job to cups which runs pstops and then sends the job along to
> >>the printer. Is foomatic inside of cups?  Is that just saying use -oraw?
> >>
> >>I can munge pstops.c  at about line 600  with this
> >>
> >>       else if ((!strncmp(line,"%%EOF",5)) || (!strcmp(line, "\004") &&
> >>len == 1) )
> >>       {
> >>         /*do nothing with EOF or ctrl-D */
> >>       }
> >>       else if (strncmp(line, "%%Pages:", 8) != 0)
> >>         pswrite(line, len, stdout);
> >>
> >>which eliminates the first EOF and ctrl-D but does not seem to strip out
> >>the color info as i want it to - this despite the presence of
> >>
> >>%%BeginFeature: *XRXColor BW
> >>
> >>  <<
> >>     /DeviceRenderingInfo currentpagedevice 1 index get 1 dict copy
> >>    dup /VirtualColorDevice <<
> >>                 /Type 1
> >>                 /ColorTransform /Gray
> >>      >> put
> >>  >> setpagedevice
> >>%%EndFeature
> >>
> >>in the ps file
> >>
> >>Is it not possible to strip the color info from this input by directing
> >>the output through pstops?
> >>
> >>I hope I'm not hammering a screw...
> >>
> >>brad
> >
> >
> > Make sure to configure your printer (on the Wondows side) to "optimize for partability"
> > (the string may be slightly different, depending on the printer driver (the DLLs) you use).
> >
> > And, please post an URL to a sample file.
> >
> > Helge
> >
> I did not have physical access to the printer last night - gv did not
> know how to read the color elimination i guess - but the printer did.
> So this fix worked for me:
> 
> --- pstops.c.orig       2005-10-14 11:19:28.142275555 -0400
> +++ pstops.c    2005-10-14 11:23:31.901801757 -0400
> @@ -599,6 +599,8 @@
>            tbytes -= nbytes;
>          }
>         }
> +      else if ((!strncmp(line,"%%EOF",5)) || (!strcmp(line, "\004") &&
> len == 1) )
> +       /*do nothing with EOF or ctrl-D they'll be added later*/
>         else if (strncmp(line, "%%Pages:", 8) != 0)
>           pswrite(line, len, stdout);
>       }
> 
> Here is the sample file that I was working with.
> ftp://lauelab.unh.edu/fromwindows.ps.zip
> 
> If you run it through pstops invalid ps is generated.
> 
> If you run it through my modified pstops then it works fine - though
> maybe I broke something else  - I'm not sure.
> 
> brad

Thanks for the sample file. It vilates nearly all of Adobe's DSC (Document Structuring Comments) 
rules. As CUPS' pstops filter heavily depends on DSC convormance, you cannot expect reasonable
output from the input as posted.

Carefully check the default properties of your printer and see if there is a choice like
"optimize for portability" or "page independence" or similar, and then select that.

If there is no such choice, I suspect there is no hole short of forcing raw printing.

Helge

-- 
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom
http://www.srz.de




More information about the cups mailing list