BSDnexus
10Oct/10Off

Debian cups-pdf

The Common UNIX Printing System (CUPS) has long been the standard of printing and print drivers for Linux. Having a PDF printer can be extremely useful - so here's how to set one up in Debian.

First, you have to install the CUPS PDF print driver

$ aptitude install cups-pdf

Next, we need to actually configure the printer itself for use. In CUPS this can be easily done via a URL and a browser of your choice (even a text based browser). Simply head over to http://localhost:631/ and in the following screen select the "Administration" option

CUPS administration option

CUPS default screen

Then select to "Add Printer"

CUPS printer administration

CUPS printer administration

How you configure the printer name and details is up to you and your setup, but it is easiest to simply use "PDF" as the printer name

CUPS add printer

CUPS add printer

Next select the "Virtual PDF Printer" as the device

CUPS select device

CUPS select device

For the make and manufacturer of printer select Generic

CUPS make and manufacturer

CUPS make and manufacturer

Finally, for the model select the "Generic CUPS-PDF Printer(en)" option

CUPS model

CUPS model

At this point you will now have a PDF printer. Some customisation is possible in the file /etc/cups/cups-pdf.conf - for example, the default location for creating PDF files is in a PDF directory in the user's home directory as identified by this entry:

Out ${HOME}/PDF

Clearly you can adjust this to suit your needs. To demonstrate the post processing options available, uncomment the PostProcessing option and alter to read as follows

PostProcessing /usr/local/bin/cups-pdf-renamer

Edit the file /usr/local/bin/cups-pdf-renamer to look as follows:

1
2
3
4
5
6
7
#!/bin/bash
 
FILENAME=`basename $1`
DIRNAME=`dirname $1`
DATE=`date +”%Y-%m-%d_%H:%M:%S”`
 
mv $1 $DIRNAME/$DATE”.pdf”

Make sure the file is executable

$ chmod +x /usr/local/bin/cups-pdf-renamer

Essentially this will rename the file to a date and time stamp. Clearly you can alter this to suit your needs. This example was taken from here

Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.