Using Cups For Network PDF Printing

From Wiki

Revision as of 01:59, 23 June 2008 by SYNACK (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to:navigation, search


  • A Debian (or derivative) system
  • CUPS and Samba setup and working correctly
  • A reasonable amount of disk space to store generated PDF files


To create a network PDF printer install the cups-pdf package on Cups print server.

apt-get install cups-pdf

The installation process for the cups-pdf package will set up the printer queue for automatically in Cups.

Next, we need to change some of the defaults for the cups-pdf package. To do this open /etc/cups/cups-pdf.conf in your favorite text editor and change the following settings:

#label file names with unique jobid to avoid overwriting jobs with the same filename
Label 1
#Disable anonymous use
#set umask
UserUMask 0077

Then samba needs to be told about the new printer. Simply reloading is enough.

/etc/init.d/samba reload

The Windows drivers need to be loaded.

cupsaddsmb -v -H <print server> -U 'accountname' PDF

At which point you can add it to your printer scripts (this will vary depending on your specific windows network enviroment) and you are able to print to the pdf printer. However there's no way to access the PDF files it produces yet, so we need to make a new share in samba for that.

comment = PDF files
path = /var/spool/cups-pdf/out
browsable = yes
read only = yes
hide unreadable = yes
guest ok = no

Users can now access this share however they like. I'd suggest either a drive mapping or a shortcut on their desktop. Also note, because of the umask we set in cups-pdf.conf and the 'hide unreadable' setting being enabled here, users will only see their own pdf prints. eg.

root@hermes:/var/spool/cups-pdf/out# ls -l
total 56
-rw------- 1 mmilne      domain users 36334 2008-03-05 08:14 job_10031-tmp7.pdf
-rw------- 1 dstephenson domain users 17119 2008-03-05 09:15 job_10055-Microsoft_Word_-_Dulce_et_decorum_est.pdf

The final thing you need to do, is clean things up on a regular basis to stop your print servers disk becoming full of useless pdf files. I do this nightly in a cronjob

0 0 * * * rm /var/spool/cups-pdf/out/*.pdf