HOWTO: Installing CUPS Print to PDF driver

From Sabayon Wiki
Jump to: navigation, search


Although some applications (e.g. have built-in support for 'printing' PDF files, and for applications without built-in support there is an installed Print to File (PDF) driver with Sabayon Linux, for some reason the Print to File (PDF) 'printer' does not appear in the list of available printers when I select Print in some applications. Therefore, if you want to install the CUPS driver to print to a PDF file, you can use the procedure given below.

Installation and configuration

In the instructions below the GNOME printer manager is used to set up the cups-pdf driver. However you could instead use the CUPS browser manager (http://localhost:631/) or KDE printer manager to do it.

1. In a Terminal window, type the following as root:

# emerge cups-pdf

or, alternatively, if you prefer to use Entropy instead of Portage:

# equo install cups-pdf

2. K Menu > Applications > Settings > GNOME Settings > Printing

3. Double-click on 'New Printer'

4. If not already selected, set 'Printer Type:' to 'Local Printer'

5. Set 'Use a detected printer:' to 'Virtual PDF Printer'

6. Click 'Forward'

7. Set 'Select Manufacturer:' to 'Generic', and set 'Model:' to 'postscript color printer rev4' (or 'CUPS-PDF' if that is listed)

8. Leave 'Driver:' as 'Standard (Suggested)'

9. Click 'Forward'

10. Enter a name of your choice (must be without spaces) in 'Enter a Name:', e.g. Print_to_PDF_file

11. Enter a description of your choice in 'Enter a Description:', e.g. Virtual printer (print to PDF file)

12. Click 'Apply'.

13. When you select Print_to_file_PDF from the list of available printers when you come to print from an application, the PDF file will be saved in the directory /var/spool/cups-pdf/<your username>/. Note that that directory will be created automatically the first time you 'print' to PDF.

14. Optionally, you can create a shortcut (Desktop Config File) on your Desktop to open the directory mentioned in Step 13 above.

15. Optionally, edit the file /etc/cups/cups-pdf.conf as root to get cups-pdf to 'print' PDF documents to your desktop instead of /var/spool/cups-pdf/<your username>/, by changing the line:

File: /etc/cups/cups-pdf.conf
#Out /var/spool/cups-pdf/${USER}


File: /etc/cups/cups-pdf.conf
Out ${HOME}/Desktop

16. Optionally, if you prefer to be prompted for a file name so that you can save the PDF file wherever you want and give it the name you want, then do the following instead of Items 14 and 15 above:

Make sure the package zenity is installed (it should be, by default, with Sabayon Linux):

# emerge -s zenity
[ Results for search key : zenity ]
[ Applications found : 1 ]

*  gnome-extra/zenity
      Latest version available: 2.24.0
      Latest version installed: 2.22.1
      Size of files: 2,183 kB
      Description:   Tool to display dialogs from the commandline and shell scripts
      License:       LGPL-2


If zenity is not installed then install it using either Portage or Entropy:

# emerge zenity


# equo install zenity

Using a text editor of your choice, create the following script in your home directory and give it a meaningful name such as

export DISPLAY
PDFNAME=$(zenity --file-selection --save --confirm-overwrite)

Make the file executable:

# chmod ugo=rwx

Edit the file /etc/cups/cups-pdf.conf, find the line starting "#PostProcessing" and change it to:

File: /etc/cups/cups-pdf.conf
PostProcessing /home/<your user name>/

Restart CUPS:

# /etc/init.d/cupsd restart

Now, when you select the Print_to_PDF_file virtual printer in your applications, a pop-up window will appear allowing you to select the target directory for the PDF file and to enter a file name of your choice.

Authored by Fitzcarraldo on 29.05.07. Significant rewrite on 09.01.09.