Add a PDF printer to CUPS

Written by Robert -

For testing purposes I needed a PDF printer installed on the print server. The server itself is running SUSE Linux Enterprise Server 11.3.

I was able to find the package on the OpenSUSE website.

https://software.opensuse.org/package/cups-pdf


First I downloaded the file to the /root folder:

wget  http://download.opensuse.org/repositories/Printing/SLE_11_SP3/x86_64/cups-pdf-2.6.1-1.1.x86_64.rpm -P /root


Then I installed the RPM file on the server.

rpm -Uhv /root/cups-pdf-2.6.1-1.1.x86_64.rpm 
# U for upgrade. This will install if the package isn’t there.
# h is for printing hash marks on the screen
# v is verbose, makes the hash marks look a bit nicer.


The combination of the h+v gives a nice output. In this case it’s a small file but it can be useful to see some information on your screen.

Preparing...                ########################################### [100%]


After this I opened the web interface so I could add the CUPS printer.

alt text

alt text

alt text

alt text

alt text

Now the printer is added. By default it writes to the /var/spool/cups-pdf/ folder. In my case, since the test prints come from a Java application that sends it by using the tomcat user, it saves it in /var/spool/cups-pdf/tomcat.

Let's change the location the printer saves to:

In het /etc/cups directory you can see the following files:

total 112K
drwxrwxr-x   6 root lp   4.0K Jan 14 14:17 .
drwxr-xr-x 105 root root  12K Jan  3 07:26 ..
-rw-------   1 root lp     82 Jul 28 12:41 classes.conf
-rw-r--r--   1 root root    0 Apr  3  2014 client.conf
-rw-r--r--   1 root root 1.1K Feb 26  2009 command.types
-rw-r--r--   1 root root 9.4K Aug 27  2013 cups-pdf.conf
-rw-r-----   1 root lp   2.6K Apr  3  2014 cupsd.conf
-rw-r-----   1 root root 4.2K Feb 14  2013 cupsd.conf.default
drwxr-xr-x   2 lp   lp   4.0K Feb 14  2013 interfaces
-rw-r--r--   1 root root 4.7K Feb 14  2013 mime.convs
-rw-r--r--   1 root root 6.4K Feb 14  2013 mime.types
drwxr-xr-x   2 root lp   4.0K Jan 14 14:17 ppd
-rw-------   1 root lp   2.0K Jan 14 14:17 printers.conf
-rw-------   1 root lp   1.8K Jan 14 13:25 printers.conf.O
-rw-r--r--   1 lp   sys   946 Sep 12  2012 pstoraster.convs
-rw-r-----   1 root lp    186 Feb 14  2013 snmp.conf
drwx------   2 root lp   4.0K Feb 14  2013 ssl
drwxrwxr-x   3 root lp   4.0K Jul 28 14:34 yes


As you can see there is a file called cups-pdf.conf. The date is the day the pdf tool was compiled.

I would like to save the documents to the /tmp directory since I only use these to test and I don't wish to fill the system up.

If you open the config file with your favorite text editor, you can see the following part in the document:

### Key: Out
##  CUPS-PDF output directory
##  special qualifiers:
##     $ will be expanded to the user's home directory
##     $ will be expanded to the user name
##  in case it is an NFS export make sure it is exported without
##  root_squash!
### Default: /var/spool/cups-pdf/$
#Out /var/spool/cups-pdf/$


There are a lot of nice things you can do with this. For example, you can have a specific PDF folder in each users folder and print the files automatically in there. In that case you would use: Out $/PDF Or Out /home/$/PDF

In my case, I don't need the files to be in the home directory but I wish to have them in the /tmp folder which get's automatically emptied at a reboot. The end result is:

Out /tmp/ 


Now we can print a test page to look at the result:

alt text

alt text

When you list the files in the tmp folder you can now see a test page:

sles:/tmp # ls -lah
total 87K
drwxrwxrwx  5 root   root    36K Jan 14 17:09 .
drwxr-xr-x 25 root   root   4.0K Jan 14 17:08 ..
-rw-------  1 root   root    47K Jan 14 17:09 Test_Page.pdf


Comments