pdf2email is a Common UNIX Printing System
(CUPS
) backend that
uses GhostScript to print a document to PDF and sends the final file
to a mail-to-printer service like the shitty system we have at work
here. This software is written in Python. The script was initially written by George Notaras; this script is a substantial rewrite by Emiliano Heyns.
The following software is required so that this backend functions correctly:
- Python 2.7 (http://www.python.org)
- CUPS server (http://www.cups.org/)
- Ghostscript (http://www.cs.wisc.edu/~ghost/)
- A mail-to-printer system like the crappy Canon systems our procurement department maintains is the best they could do.
Put the pdf2email
script in /usr/lib/cups/backend/
and set the executable bit:
chmod +x /usr/lib/cups/backend/pdf2email
copy pdf2email.conf
to /etc/cups/pdf2email.conf
and edit as appropriate. For every user that you want to enable printing for you will have to add a [<username>]
section.
This section describes in brief all the required actions in order to add a printer that uses this backend to CUPS.
- Decide the printer’s name, eg
TestPDFprinter
. - Decide the directory, where the PDF files are saved temporarily. This directory must be writable by the users. Usually,
/tmp
is perfect for this. Note, that no PDF files are left in this directory. This piece of information is used in the Device URI of your CUPS printer. For example, provided that the/tmp
directory will be used, the Device URI would be:pdf2email:/tmp
- Get a postscript printer’s PPD file. You can find such files at:
- Your printer manufacturer‘s web site.
- Linux Printing
- Adobe’s download center
- Or you can use
email.ppd
from this repository
WARNING: It is your exclusive responsibility to examine the printer driver’s license prior to using the PPD file.
Finally, add a new printer that uses this backend, by using lpadmin from the command line. As root issue the following command:
lpadmin -p TestPDFprinter -E -v pdf2email:/tmp -P /path/to/myprinter.ppd
Make this printer available to the LAN through the IPP, SAMBA or any other protocol and add it to your printer list in your client machines. Whatever you send to that printer will be converted to a PDF document and will be emailed to the email address in the [To]
section.
If any error occurs during the PDF creation process, there will be a failure notice in your inbox and a message in syslog (/var/log/syslog
).
In case you receive no email after requesting a print, check syslog for any error messages. If there aren’t any, the check CUPS error log.
Finally, note that if you use a security layer like SELinux, then you might need to further adjust it so it lets 3rd party CUPS backends to function. This is beyond the scope of this document.
This project is released under the terms of the GNU General Public License version 2 or later.
This software is released as free software without any warranties or official support.