banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Configuring CUPS-PDF


by phorneker

When I print from Firefox, I noticed that there are two options for creation of PDF files. The first option allows Firefox to directly create the PDF file, i.e. Firefox will not use CUPS to print. The second option is the use of the CUPS-PDF driver.

The cups-pdf package can be installed from Synaptic, and must be installed before anything in this article will work. Note: the task-printing package will not install this by default.

The second option will print, but where is the PDF file that was created? A little Google search gave me the answer. By default, the file is stored in /var/spool/cups-pdf/, which means you have to open a terminal window and login as root (with the su command, of course), then change to that directory and copy the PDF file. The file created has root as the owner, which means we have to use the chown command on the file before we can do anything with it.

So how do we fix this? Open a terminal window and type the following:

chdir ; mkdir PDF

(if you are already in your home directory, simply type mkdir PDF)

The PDF must be in all capital letters for the configuration to work.



However, it does not have to be that way. In /etc/cups/cups-pdf.conf, the Out statement tells the CUPS-PDF driver where to store the output.

Once the directory is created, anything that was in the CUPS-PDF spooler will automatically transfer to ~/PDF.

By default, CUPS-PDF spools output to /var/spool/cups-pdf/SPOOL. Unless you have a user on your system that has "SPOOL" (in all capital letters) for a username, there is no need to change this parameter.

Filename Handling

If an application supplies a filename (or if you supply one or more filenames to the lpr -P CUPS-PDF command), the CUPS-PDF backend and driver will assign that name to the output file(s) with the PDF extension.

Filenames assigned to CUPS-PDF must have a minimum length of eight characters, but no more than 64 characters. The Truncate command in cups-pdf.conf can be changed to any length you want. The default here is 64 characters due to allow Windows machines to print to CUPS servers.

If there is a extension in the filename, CUPS-PDF will remove the extension (of three or fewer characters be default) before placing the .pdf extension on the output file. The Cut command in cups-pdf.conf can be set to any length. Truncation will happen when the extension has the same or fewer number of characters in length as the value assigned to the Cut command.

However, CUPS-PDF will not truncate the filename if Cut is set to -1, which means disable truncation of filenames. This is useful on networks that are pure UNIX, i.e. have no machines running any version of Windows, DOS or OS/2 (including ArcaOS).

Finally, if an application (such as LibreOffice) prints a untitled document, the Label command assigns "job_" followed by the job number to the filename.

If Label is set to 0, the resulting filename will be called job_<job number>.pdf where job number is the ID of the print job assigned to CUPS. (This applies to untitled documents only.)

If Label is set to 1, the resulting filename will be called job_<job number>-<filename>.pdf where filename is the name of the file assigned to the CUPS-PDF backend.

If Label is set to 2, the resulting filename will be called <filename>-job_<job number>.pdf.

The LowerCase command, when set to 1 (by default) ensures that documents printed to CUPS-PDF from DOS or Windows 3.x machines will be uniquely named so output files can be properly identified as those coming from a DOS/Windows 3.x machine. (Case adjustments in the filenames are necessary to accommodate 8.3 filenames, of which are not case sensitive.)

Once /etc/cups/cups-pdf.conf has been configured, it is a good idea to reboot PCLinuxOS to ensure the configuration changes take effect.

Once you reboot, creating PDF files is as simple as printing to the CUPS-PDF queue.

If you need to use a command line, the following command will generate PDF files from your PostScript output files.

lpr -P CUPS-PDF <filelist>

Where filelist is a list of CUPS supported filenames with the types listed in /usr/share/cups/mime/mime.types of which the following are valid for PCLinuxOS:

  • PostScript

  • PDF (which makes no sense as the files are already in PDF format to begin with)

  • GIF

  • PNG

  • JPEG (including JPEG 2000)

  • TIFF

  • Kodak Photo CD (the antiquated format Kodak used for its Photo CD services)

  • XPM (X Window System Pixmap)

  • XBM (X Window System Bitmap)

  • XWD (The X Window System screenshot format)

  • Sun Raster (found in pre-Oracle Solaris/SunOS installations)

  • ICO (Windows Icon format)

  • BMP (Windows Bitmap format)

  • PNM (portable graphics formats for almost anything graphical)

  • PBM (portable color bitmap graphics format)

  • PGM (the greyscale version of PBM)

  • PPM (found in some so-called Windows-only printers)

  • SH and CSH (shell scripting)

  • PL (Perl source files)

  • HTML, XHTML, and XML (in other words, any type of XML, treated as plain text files)

  • TXT (plain text files)

  • CSS (Those stylesheets found on websites and some web applications)

  • Any source code file written in any programming language

In other words, if you can open the file in a text editor or the GIMP (for graphics), you can convert it to a PDF with CUPS-PDF.

Why make PDF files in the first place?

  1. You can view PDF files before printing them (using an application such as Okular or xpdf), saving ink and paper in the process.

  2. PDF stands for Portable Document Format, and can be viewed, archived, or transmitted most anywhere (even faxed with the right software), and they can be printed from any copier with a port for USB flash drives.

  3. PDF files are viewable not only on PCLinuxOS machines, but also smartphones, tablets, and electronic book readers such as the Kindle line from Amazon or the Nook line from Barnes and Noble.

  4. If you are running DOS and Windows 3.x applications in DosBox, the only option to print is to print to a disk file, provided the application can print text and/or PostScript.

Also, if you take your PCLinuxOS laptop with you, you will be able to print wherever you are and have a set of documents for printing later after you return from your trip.



Previous Page              Top              Next Page