AirPrint to cups-pdf on Ubuntu


welcome_airprint2I got the 3rd generation iPad and needed to print some emails ? actually to save them as pdf. Easy enough to do on a Mac in Safari, but not an option in iOS 5.1. So, to get AirPrint working with cups-pdf on Ubuntu 10.04.4 LTS.


Prior to this, I used to get AirPrint working with a regular printer. I manually duplicated the avahi service file for the cups-pdf printer from the regular printer created with the script. I imagine I could have used it again to create a avahi service file for cups-pdf.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 <name replace-wildcards="yes">AirPrint PDF @ server.local</name>
 <txt-record>product=(GPL Ghostscript)</txt-record>

Of course, the key entry here, is the cups path to to printer:


I suppose it could be a path to a different cups server.


If not installed, install it on Ubuntu with:

apt-get install cups-pdf

Then, in cd /var/spool/cups-pdf/ we will have to make a link to your home directory. In this tutorial, I am using Dropbox to sync the generated pdfs. So, I created a link to a folder in my Dropbox folder for anonymous pdf files.

ls -la
total 16
drwxr-xr-x 4 root root 4096 2012-03-17 00:48 .
drwxr-xr-x 9 root root 4096 2012-03-17 00:15 ..
lrwxrwxrwx 1 root root 27 2012-03-17 00:38 ANONYMOUS -> /home/<user>/Dropbox/Docs/PDF
drwxrwxrwt 2 root lpadmin 4096 2012-03-17 00:46 ANONYMOUS-orig
drwxr-x--x 2 root lpadmin 4096 2012-03-17 10:32 SPOOL

Also, we need to change some settings in /etc/cups/cups-pdf.conf. Since this server is only for me, I don’t really have to worry about others, so I change the user output destination.

Out ${HOME}/Dropbox/Docs/PDF

I was also forced to change the AnonUser to my own account. Obviously, I would have liked to not have done this, but I had to, to get it to work.

AnonUser <youraccount>


I also had to change apparmor a bit as it wasn’t allowing cups to write files in my user directory.


Find the lines with “{HOME}” and “PDF” in them and change to match the desired destination:

@{HOME}/Dropbox/Docs/PDF/ rw,
 @{HOME}/Dropbox/Docs/PDF/* rw,

Once that is done, restart apparmor, cups, and avahi. Log files for cups-pdf are at /var/log/cups/cups-pdf_log.

If you get a error like

[ERROR] failed to set file mode for PDF file (non fatal) (<path>/Test_Page.pdf)

Either you have filesystems permissions or app armor is causing problems.


Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: