[Samba] Printing with CUPS and PDF

Tom samba-lists at fleet.ucdavis.edu
Mon Mar 31 23:00:22 GMT 2003


PDF printing through CUPS backend: Got it to work. Gory details follow.

Kurt Pfeifle wrote:
>> Tom samba-lists at fleet.ucdavis.edu wrote on Samba-Digest:
> 
> 
>> Mon Mar 31 11:57:58 GMT 2003
>>
>>
>> Everything goes smoothly with the installation... drop 'pdfdistiller' 
>> into /usr/lib/cups/backend,
> 
> 
> I hope you didn't use "copy'n'paste" from your browser, but "Save as..."
> to get it?

I didn't. That file was fine.

> 
>> chmod +x, restart cups service. Add a printer in cups with:
>>
>> 'lpadmin -p PDF -E -v pdf:/tmp/'
>>
>> ...and voila! Nothing happens.
> 
> 
> Of course not. You have not yet associated a PPD with it, which means you
> are running it as a "raw" printer.

Gentle readers, remember this lesson. A PPD file is necessary even for 
printing to PDF files.

> 
>> Doesn't give any errors, but it won't print ('lpr -P PDF foo.ps'). 
>> Delete the printer ('lpadmin -x PDF'), download distiller.ppd (found 
>> here: http://www.pentondigitalads.com/downloads/adist4.zip). Copy new 
>> ppd file to /usr/share/cups/model. Re-add printer with:
>>
>> 'lpadmin -p PDF -E -v pdf:/tmp/ -m distiller.ppd'
>>
>> ...and there we go! Still nothing prints. :(
> 
> 
> OK.
> 
> Did you re-start cupsd after dropping the "distiller.ppd" into
> "/usr/share/cups/model/" ? This is required to allow CUPS to rebuild
> its cache of available PPDs from that directory. Only if there is a
> valid cache, you can install the PPD using the "-m" parameter without
> the path.
> 
> Otherwise use the absolute path; then you don't need to re-start cupsd
> after updating your PPD "model" directory:
> 
>   'lpadmin -p PDF -E -v pdf:/tmp/ -P /usr/share/cups/model/distiller.ppd'
> 
> Do you see a "/etc/cups/ppd/PDF.ppd" ?
> 
> To check if CUPS is recogizing the newly available backend, let root run
> 
>   "lpinfo -v"
> 
> and grep for "pdf".
> 
> To check if it basically works as a backend, first run it with no 
> arguments:
> 
>   "/usr/lib/cups/backend/pdfdistiller"
> 
> and it should output
> 
>   'direct pdf "Unknown" "PDF Writing"'
> 
> Then run it with a wrong number of arguments (use 1, 2, 3, or 4 dummy 
> arguments)
> 
>    "/usr/lib/cups/backend/pdfdistiller 1 2 a b"
> 
> and it should output
> 
>    "Usage: pdf job-id user title copies options [file]"
> 
> The PDF should go to "/tmp/", according to your installation. Backends 
> are running
> as root, and for paranoid security you may not want to write files as 
> root into
> "/tmp/". Better use a separate directory with access rights you need:
> 
>    "lpadmin -p PDF -E -v pdf:/home/username/pdfs/ -P 
> /usr/share/cups/model/distiller.ppd"
> 
> Further, the script relies on "ps2pdf" to be present on your system. Do 
> you get
> an answer to this:
> 
>    "which ps2pdf"

I did restart, I did get all of those messages, 'which ps2pdf' comes up 
fine, everyone works great according to your docs up to this point.

> 
> Last: If you want to get some more debugging info into the CUPS error_log
> (in "/var/log/cups/error_log"), insert this line
> 
>    "set -x"
> 
> into the "pdfdistiller" as the right after the first line. Set cupsd.conf
> to "LogLevel debug" and re-start cupsd.

This is what fixed it for me... adding "set -x" in pdfdistiller and 
"LogLevel debug" into cupsd.conf gave me much better info to dig through 
in /var/log/cups/error_log.

Here's a chunk of what I found:

D [31/Mar/2003:14:19:22 -0800] StartJob: backend = 
"/usr/lib/cups/backend/pdf"
D [31/Mar/2003:14:19:22 -0800] StartJob: filterfds[1] = -1, 9
D [31/Mar/2003:14:19:22 -0800] 
start_process("/usr/lib/cups/backend/pdf", 0xbfffb730, 0xbfffabe0, 10, 9, 7)
I [31/Mar/2003:14:19:22 -0800] Started backend /usr/lib/cups/backend/pdf 
(PID 4179) for job 155.
E [31/Mar/2003:14:19:22 -0800] PID 4179 stopped with status 22!
D [31/Mar/2003:14:19:22 -0800] [Job 155] /usr/lib/cups/backend/pdf: No 
such file or directory	

It was looking for "/usr/lib/cups/backend/pdf" as the backend instead of 
"/usr/lib/cups/backend/pdfdistiller", which is what the file was named. 
I made a copy called "/usr/lib/cups/backend/pdf" and it worked fine. I 
do not yet know why cups was looking for the file as "pdf" instead of 
"pdfdistiller", but this was the entirety of the issue.

> 
>> I dig the simplicity of the solution at
>> http://printing.kde.org/downloads/
>> but given that it doesn't seem to work for me, I can hardly recommend it.
> 
> 
> You don't need to recommend it -- *I'll* be doing it...   ;-)

Ok, now that makes two of us! :)

Thanks Kurt!

-Tom



More information about the samba mailing list