Friday, November 21, 2008

Sharing a CUPS-PDF Printer Over IPP

Generating PDF documents is easy enough on Window$: install PDFCreator and print from any application to the newly created PDF printer.

The same is possible on Linux using a CUPS-PDF printer. It's even easier if the source document is an document, because you can directly export it to PDF. Not to mention a lot of other applications that let you create PDF documents directly, or convert from most formats to PDF.

I recently needed to generate PDF documents on my VirtualBox hosted Window$ XP virtual PC. But instead of installing PDFCreator, it seemed to make more sense to "simply" print to the existing CUPS-PDF printer - it's just a matter of installing a new IPP printer at the Window$ side...

Start at the Linux box:
  1. point your browser to the local CUPS administration web interface: http://localhost:631
  2. click the Printers tab, scroll down until you find the PDF printer - write down its URL
And now for the main event, at a real or virtual Window$ XP box:
  1. open the Printers and Faxes folder
  2. from the menu select File->Add Printer
  3. click Next until the wizard asks you to choose between a local or network printer, select the network printer and click Next
  4. specify the printer with the URL recorded earlier, but replace localhost with the Linux box IP address, e.g.
    and click Next
  5. select a printer driver - in our case any Color PostScript printer should be OK
  6. a few more mouse clicks and we're done
At this point the newly created PDF printer can be used to generate PDF documents by printing to it from any application.

The documents will be created, by default, in the PDF directory at your Linux user account. If you're printing from a Window$ user account with a username that does not match any user account on the Linux box, then the generated PDF files will land in /var/spool/cups-pdf/ANONYMOUS/ (the paths can be configured by editing /etc/cups/cups-pdf.conf).

The problem with the procedure above is that the printer driver selected for the new printer does not match the capabilities and limitations of the CUPS-PDF printer. The Right ThingTM to do is to install a PostScript printer driver with the correct CUPS-PDF PPD file:
  1. copy the file CUPS-PDF.ppd from the Linux box (find it at /usr/share/ppd/cups-pdf/CUPS-PDF.ppd) to a temporary folder on the Window$ box
  2. download the Adobe PostScript Universal Printer Driver for Windows Installer
  3. launch the installer - a printer installation wizard will come up
  4. tell it that the printer to install is a Local Printer, connected to LPT1: or any other local port
  5. when prompted to select a printer model, click Browse and search for the PPD file
  6. you should now be able to select "Generic CUPS-PDF Printer" and continue
The new local printer is a fake one, that's used only to get the driver installed. The next step is to replace the IPP printer's driver with this new driver:
  1. open the Printers and Faxes folder
  2. right-click the IPP PDF printer icon, select "Properties" from the pop-up menu
  3. select the Advanced tab
  4. select "AdobePS Generic CUPS-PDFPRinter" from the Driver drop-down selection box
  5. click OK
  6. delete the fake local CUPS-PDF printer

I hope you realize by now that it's much simpler to install PDFCreator and be done with it, instead of all this futzing around with PPD files and all those printer installations and driver replacements.

Bottom line: sharing a CUPS-PDF printer is perfectly feasible, yet, at the same time, quite pointless.


  1. Hee, Hee -

    >Bottom line: sharing a CUPS-PDF printer
    >is perfectly feasible, yet, at the same
    >time, quite pointless.

    Well, I wouldn't call it pointless, I find having a virtual computer printing to a non-existing printer attached to a fictitious NT server over a virtual network very satisfying!
    And more importantly, it lets me play around with Samba and Cups without the need for any hardware.

    Thanks very much for your article, I had to hunt down my Cups-PDF printer by searching for the IP of my Linux box in windows for some reason, I couldn't even browse for it even though I can find my folder shares fine in the workgroup. So I guess my Samba set-up ain't quite there yet.

    Great fun though, thanks very much!

  2. Good point - testing is (almost) never pointless...

    Great fun?? Dude, you're too kind. Thanks!

  3. I have a cups-pdf printer setup in my Fedora 13 machine. I able to print from my Windows 7 desktop using the IPP protocol:


    However, if the Windows logon user name doesn't exist in Linux passwd, then the output PDF shown in /var/spool/cups-pdf/ANONYMOUS.

    Is that possible to do some configuration on IPP protocol on Windows to send username to cups-pdf so the output pdf file will appear in my home folder?

  4. Well, I don't know how to print as a different user over ipp.

    BUT you can change the path for anonymous cups-pdf print jobs (such as those sent over from a windows box) by modifying the key AnonDirName in /etc/cups/cups-pdf.conf

    Hope this helps.

  5. I too get prints in /var/spool/cups-pdf/ANONYMOUS, but I solved this "problem" adding a symlink to that position in my home dir, so I can easily get prints from there just copying and pasting them.

    Another problem is that normal users can't remove pdf files from there.
    I solved this issue just creating a cron job that uses "find" to remove from /var/spool/cups-pdf/ANONYMOUS files older than a few days, so I can get my "prints".

    I prefer this solution because it doesn't need extra software (like PDFCreato) running in my virtual machine.


Note: Only a member of this blog may post a comment.