[cups.general] Printing to a file...

Daniel Hawker Daniel.Hawker at animal.co.uk
Mon Jan 24 01:41:22 PST 2005


Helge,

Thanks for your reply, I thankfully managed to get it to work. (Thought
I had sent a SOLVED message to the list).

Anyway the fix was to edit the backend sightly and also add some extra
log entries to it to see when it barfed. As it happens, it ended up
being a simple problem with it not setting the spool file as the
*source* for pcl2pdf to parse, it was sending a blank file (and hence
the lack of an outputted file). Well that was the end problem, there was
a couple of *extra* problems with the backend too, namely the path to
the *output folder* was playing up.

Anyway, thanks for all your help

Dan 

> -----Original Message-----
> From: Helge Blischke [mailto:h.blischke at srz.de] 
> Sent: 22 January 2005 17:45
> To: cups at easysw.com
> Subject: Re: [cups.general] Printing to a file...
> 
> 
> Your backend exited with status 1, that means some error 
> occurred. Perhaps you could wrap the pcl2pdf utility with 
> strace (or whatever the 
> system call trace is known as) and look for the error codes.
> 
> Helge
> 
> 
> Daniel Hawker wrote:
> > 
> > >
> > > Get that script (link as from the CUPS web site)
> > >
> > >              ftp://ftp.kde.org/pub/kde/printing/pdfdistiller
> > >
> > > and edit accordingly (modify the Ghostscript command line 
> including 
> > > the respective options for GhostPCL.
> > >
> > > Helge
> > 
> > Helge,
> > 
> > I have downloaded the above distiller backend script 
> (previously tried 
> > using it before I digressed around a bit) and all *seems* fine. 
> > However I still don't get a pdf file at the end.
> > 
> > I have upped the Log level to debug to try and see what is going on.
> > 
> > It *seems* that the file is sent to cups as PCL as 
> expected. CUPS then 
> > analyses it, sets it up and passes it to the backend. 
> Unfortunately it 
> > doesn't get any further. If I look in the CUPS Print Queue (via the
> > web-browser) it just says its *pending*. If I look in 
> /var/spool/cups 
> > there is an appropriate spool file in there. I can then send it 
> > directly to pcl2pdf from the command-line and sure enough a pdf is 
> > output. Looking at  error_log... It just stops the job with 
> *printer 
> > state is 3* ???
> > 
> > Any ideas???  The salient points of the error_log and also 
> the backend 
> > script are below The backend script is *exactly* the same 
> as the one 
> > from kde downloads page, but with pcl2pdf used instead of 
> ps2pdf. As 
> > GhostPCL uses the same syntax as GhostScript, I presume 
> this will work 
> > fine.
> > 
> > TIA
> > 
> > Dan
> > 
> > ----error_log----
> > 
> > D [19/Jan/2005:17:53:41 +0000] StartJob(5787, 0x80cc798)
> > D [19/Jan/2005:17:53:41 +0000] StartJob() id = 5787, file = 0/1 D 
> > [19/Jan/2005:17:53:41 +0000] StartJob: Sending job to queue 
> tagged as 
> > raw... D [19/Jan/2005:17:53:41 +0000] job-sheets=none,none
> > D [19/Jan/2005:17:53:41 +0000] banner_page = 0
> > D [19/Jan/2005:17:53:41 +0000] StartJob: argv =
> > 
> "PCLPDFWRITER","5787","dh1","fileVbkVan","1","","/var/spool/cu
> ps/d05787-
> > 001"
> > D [19/Jan/2005:17:53:41 +0000] StartJob: envp =
> > 
> "PATH=/usr/lib/cups/filter:/bin:/usr/bin","SOFTWARE=CUPS/1.1",
> "USER=root
> > 
> ","CHARSET=iso-8859-1","LANG=en_GB","","PPD=/etc/cups/ppd/PCLP
> DFWRITER.p
> > 
> pd","CUPS_SERVERROOT=/etc/cups","RIP_MAX_CACHE=8m","TMPDIR=/va
> r/spool/cu
> > 
> ps/tmp","CONTENT_TYPE=application/vnd.cups-raw","DEVICE_URI=pc
> lpdf://tmp
> > 
> /pdf_out/","PRINTER=PCLPDFWRITER","CUPS_DATADIR=/usr/share/cup
> s","CUPS_F
> > ONTPATH=/usr/share/cups/fonts","","",""
> > D [19/Jan/2005:17:53:41 +0000] StartJob: statusfds = 4, 6
> > D [19/Jan/2005:17:53:41 +0000] StartJob: filterfds[1] = 8, -1
> > D [19/Jan/2005:17:53:41 +0000] StartJob: backend =
> > "/usr/lib/cups/backend/pclpdf"
> > D [19/Jan/2005:17:53:41 +0000] StartJob: filterfds[0] = -1, 9
> > D [19/Jan/2005:17:53:41 +0000]
> > start_process("/usr/lib/cups/backend/pclpdf", 0xbfff8bf0, 
> 0xbfff80a0, 8,
> > 9, 6)
> > I [19/Jan/2005:17:53:41 +0000] Started backend
> > /usr/lib/cups/backend/pclpdf (PID 30067) for job 5787.
> > E [19/Jan/2005:17:53:41 +0000] PID 30067 stopped with status 1!
> > D [19/Jan/2005:17:53:41 +0000] UpdateJob: job 5787, file 0 
> is complete.
> > D [19/Jan/2005:17:53:41 +0000] StopJob: id = 5787, force = 0
> > D [19/Jan/2005:17:53:41 +0000] StopJob: printer state is 3
> > 
> > ----end of error_log----
> > 
> > ----pclpdf backend script----
> > LOGFILE=/tmp/pdf.log
> > PDFBIN=`which pcl2pdf`
> > FILENAME=
> > # this is borrowed from printpdf script for the filename 
> > PRINTTIME=`date +%b%d-%H%M%S`
> > 
> > echo "Executable: $PDFBIN" > $LOGFILE
> > echo "Arguments: |$1|$2|$3|$4|$5|$6|" >> $LOGFILE
> > echo $# $PRINTTIME >> $LOGFILE
> > 
> > # case of no argument, prints available URIs
> > if [ $# -eq 0 ]; then
> >         if [ ! -x "$PDFBIN" ]; then
> >                 exit 0
> >         fi
> >         echo "direct pclpdf \"Unknown\" \"PDF Writing via PCL\""
> >         exit 0
> > fi
> > 
> > # case of wrong number of arguments
> > if [ $# -ne 5 -a $# -ne 6 ]; then
> >         echo "Usage: pdf job-id user title copies options [file]"
> >         exit 1
> > fi
> > 
> > # get PDF directory from device URI, and check write status 
> > PDFDIR=${DEVICE_URI#pdf:} if [ ! -d "$PDFDIR" -o ! -w "$PDFDIR" ]; 
> > then
> >         echo "ERROR: directory $PDFDIR not writable"
> >         exit 1
> > fi
> > 
> > echo "PDF directory: $PDFDIR" >> $LOGFILE
> > 
> > # generate output filename
> > OUTPUTFILENAME=
> > if [ "$3" = "" ]; then
> >         OUTPUTFILENAME="$PDFDIR/unknown.pdf"
> > else
> >         # OUTPUTFILENAME="$PDFDIR/${3//[^[:alnum:]]/_}.pdf"
> >         # I changed this to user name, and the printtime to 
> track down 
> > who
> >         # printed the PDF and when, samba printing just uses nobody
> > 
> >         OUTPUTFILENAME="$PDFDIR/$2-$PRINTTIME.pdf"
> >         echo "PDF file: $OUTPUTFILENAME placed in: $PDFDIR" >> 
> > $LOGFILE fi
> > 
> > echo "Output file name: $OUTPUTFILENAME" >> $LOGFILE
> > 
> > # run GhostPCL
> > if [ $# -eq 6 ]; then
> >         $PDFBIN $6 "$OUTPUTFILENAME"
> > #>& /dev/null
> > else
> >         $PDFBIN $6 "$OUTPUTFILENAME" >& /dev/null
> > fi
> > 
> > # modify ownership and permissions on the file
> > #  - world readable
> > #  - owns to user specified in argument
> > chmod a+r "$OUTPUTFILENAME"
> > if [ "$2" != "" ]; then
> >         chown $2 "$OUTPUTFILENAME"
> > fi
> > 
> > exit 0
> > 
> > ----end of pclpdf backend script----
> 
> -- 
> Helge Blischke
> Softwareentwicklung
> SRZ Berlin | Firmengruppe besscom
> http://www.srz.de
> tel: +49 30 75301-360 _______________________________________________
> cups mailing list
> cups at easysw.com
> http://lists.easysw.com/mailman/listinfo/cups
> 





More information about the cups mailing list