Error about Ghostscript

chris zqy2000zqy at gmail.com
Mon Oct 15 22:18:05 PDT 2007


> chris wrote:
> >> chris schrieb:
> >>> I build cups gs hpijs.. and run in the Embedded System
> >>>
> >>> When I start cupsd and run lp to print a text file , I have the error_log as below,  error is at tail.
> >>>
> >>>
> >>> But if I first run texttops generate a ps file, and then use gs to generate pcl file, then use lp to print this pcl file. I can get the printed file.
> >>> D [15/Oct/2007:20:48:35 +0000] [Job 2] renderer command: gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs -sIjsServer=hpijs -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="deskjet 3600" -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -r300 -sIjsParams=Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=1 -dIjsUseOutputFD -sOutputFile=- -
> >>> D [15/Oct/2007:20:48:39 +0000] [Job 2] foomatic-gswrapper: gs '-sstdout=%stderr' '-dBATCH' '-dPARANOIDSAFER' '-dQUIET' '-dNOPAUSE' '-sDEVICE=ijs' '-sIjsServer=hpijs' '-sDeviceManufacturer=HEWLETT-PACKARD' '-sDeviceModel=deskjet 3600' '-dDEVICEWIDTHPOINTS=612' '-dDEVICEHEIGHTPOINTS=792' '-r300' '-sIjsParams=Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=1' '-dIjsUseOutputFD' '-sOutputFile=%stdout' '-'
> >>> D [15/Oct/2007:20:48:40 +0000] [Job 2]
> >>> D [15/Oct/2007:20:48:40 +0000] [Job 2] Closing renderer
> >>> D [15/Oct/2007:20:48:41 +0000] [Job 2] unable to create Job object err=3
> >>> D [15/Oct/2007:20:48:41 +0000] [Job 2] Segmentation fault
> >> Ouch - something dies here rather badly.
> >>
> >> Can you run all that commands in a pipe successfully?
> >>
> >> texttops ... | gs ... | lp ...
> >>
> >>
> >> --
> >> Tomasz Chmielewski
> >> http://wpkg.org
> >>
> >
> >
> > Now I texttops ... generate a ps file
> > and run gs ... -sOutputFile=xxx.pcl xxx.ps
> > and lp -o raw xxx.pcl
> >
> > How run all that in a pipe?
> > texttops ...  | gs -sOutputFile=xxx.pcl  ?    this mybe wrong
> > Thanks
>
>
> * You need to use all commandline parameters that you use from the lp/lpr
>   commandline as well.
>
> * You need to specifiy all the default parameters that are stored in
>   ~/.cups/lpoptions and in /etc/cups/lpoptions.
>
> * You need to set the env var PPD to the same ppd that your printer uses.
>
> * You need to run each filter with the CUPS-required arguments, in the
>   same order.
>
> Unfortunately, foomatic-rip does not always behave like a standard CUPS
> filter should behave (using 5 or 6 arguments in a given order, that is
> shown if you run any of the other CUPS filters with zero arguments). At
> least I've seen versions which were not that easy to run on the command
> line. You need to supply additional env vars on the commandline (like
> CUPS_SERVER) to make it behave like a CUPS filter.
>
>
> Example:
> --------
>
> commandline to print was
>
>    lp -d printername \
>       -o PageSize=A3 \
>       -o prettyprint=true \
>       /home/zyq/text.txt
>
> lpoptions -d printername returns a line of
>
>    page-top=33 page-bottom=40 page-left=50 page-right=20 landscape=true
>
> then your procedure should be like this:
>
> params="page-top=33 \
>        page-bottom=40 \
>        page-left=50 \
>        page-right=20 \
>        landscape=true \
>        PageSize=A3 \
>        prettyprint=true"
>
> args="22 someone my_jobtitle 1 \"${params}\""
> (where: "22" is the fake job ID,
>         "someone"  is the fake user name,
>         "my_jobtitle" the fake job title
>         "1" is the number of requested job copies)
>
> and your pipeline would be
>
> PPD=/etc/cups/ppd/printername.ppd \
>     /usr/lib/cups/filter/texttops "${args}" /home/zyq/text.txt \
>     | /usr/lib/cups/filter/pstops "${args}" \
>     | /usr/lib/cups/filter/foomatic-rip "${args}" \
>     | tee resulting-printfile.prn
>
> resulting-printfile.prn is now the file that should be fed to the gs
> command line. If you can preview that file in a PS viewer of your
> choice, and if it displays OK, your CUPS filters work as expected.
>
> The fault then is with the next filter in the chain, foomatic-rip
> (which, as I said, is not a CUPS-shipped filter).
>
> I've not tested the above, but you may need to fiddle with the shell
> escapes for the quotes a bit...
>
> And if you want to be even more sophisticated in your debugging, you'd
> create a separate file for the output of each filter, and a separate
> *.err error log (and you probably can simplify your $args to the dummy
> "1 2 3 4 5" too, and test the full swag later):
>
>
> PPD=/etc/cups/ppd/isc2428ps.ppd \
>     /usr/lib/cups/filter/texttops 1 2 3 4 5 /etc/cups/mime.types \
>     2> texttops.err \
>     | tee output-from-texttops.prn \
>     | PPD=/etc/cups/ppd/isc2428ps.ppd \
>     /usr/lib/cups/filter/pstops  1 2 3 4 5 \
>     2> pstops.err \
>     | tee output-from-pstops.prn
>
> PPD=/etc/cups/ppd/isc2428ps.ppd \
>     /usr/lib/cups/filter/foomatic-rip 1 2 3 4 5 output-from-pstops.prn \
>     2> foomatic-rip.err \
>     | tee resulting-printfile.prn
>
>
> --
> Kurt Pfeifle
> System & Network Printing Consultant ---- Linux/Unix/Windows/Samba/CUPS
> Infotec Deutschland GmbH  .....................  Hedelfinger Strasse 58
> A RICOH Company  ...........................  D-70327 Stuttgart/Germany




Thanks , I follow your example and I can get the file should be fed to the gs command line.    If I manully run gs and lp the printer works fine.   If they run in cups automately, I has this error.

I think the root cause is arond foomatic-rip or gs or hpijs
As you said how to make foomatic-rip behave like a CUPS filter.


I add some print in foomatic-rip :
print $logh "called with arguments: '", join("', '", at ARGV), "'\n";

and in the log:
called with arguments: '5', 'root', 'inittab', '1', ''




More information about the cups mailing list