Postbooks Print PDF to Email – Ugly PDF Fix

When printing from Postbooks you…

Login

Blog History

When printing from Postbooks you can Print to PDF or PostScript file or to a local or network connected printer.

I would like to print invoices from Postbooks to my email account so I can then forward the email on to the client which has the benefit of keeping a paper trail of when and where you sent what to whom.

I installed the mailto backend from http://cups-mailto.sourceforge.net/ along with the accompanying PDF.ppd from http://cups-mailto.cvs.sourceforge.net/viewvc/cups-mailto/pdf-filter/pdf.ppd

# install the mailto backend into cups
cp mailto /usr/lib/cups/backend
chmod 700 /usr/lib/cups/backend/mailto
systemctl reload cups

And added the printer using system-config-printer

Screenshot from 2015-04-14 07:58:56

 

Screenshot from 2015-04-14 07:59:22

 

Screenshot from 2015-04-14 07:59:42

So after doing the above and making an edit to /etc/aliases to add the target email address for the local user account you use to print your Postbooks invoices from

... rest of /etc/aliases above ...
# Person who should get root's mail
#root:          marc

# user account => email address 
jmcd:           [email protected]

remember to run newaliases to rebuild /etc/aliases.db  and reload your mail server to pick up the change

newaliases
systemctl reload postfix

The result of printing from Postbooks to the printer was that the PDF looked like it had no font smoothing / anti-aliasing going on

invoice_header_no_name_font

Looking at the PDF Properties from evince viewer:

properties_no_name

Even worse was when you tried to copy any text from the PDF the pasted text was garbled symbols

copy_and_paste_no_name

So how to fix?

In PDF.ppd downloaded from cups-mailto the cupFilter line was this:

*cupsFilter:	"application/vnd.cups-postscript 33 pstopdf"

Which caused cups on my Fedora 21 system to run the following filter chain

Apr 13 18:06:06 bb01.jmcd cupsd[10749]: [Job 971] Started filter /usr/lib/cups/filter/pdftopdf (PID 2248)
Apr 13 18:06:06 bb01.jmcd cupsd[10749]: [Job 971] Started filter /usr/lib/cups/filter/pdftops (PID 2249)
Apr 13 18:06:06 bb01.jmcd cupsd[10749]: [Job 971] Started filter /usr/lib/cups/filter/pstopdf (PID 2250)
Apr 13 18:06:06 bb01.jmcd cupsd[10749]: [Job 971] Started backend /usr/lib/cups/backend/mailto (PID 2251)

By the time the input file reached the backend it was mangled.

Looking around on my system I found that there was a generic PDF ppd located at /usr/share/ppd/cupsfilters/Generic-PDF_Printer-PDF.ppd this had the following cups filter lines

*cupsFilter: "application/vnd.cups-pdf 0 -"
*cupsFilter2: "application/pdf application/vnd.cups-pdf 0 pdftopdf"

So I replaced the original cupsFilter line with the above as below

You could make this edit to the installed ppd in /etc/cups/ppd/<printer_name>.ppd and reload cups or edit a copy of the PDF.ppd and re-install it via the system-config-printer using the Change... button next to the Make and Model: field

Screenshot from 2015-04-14 08:27:57

*PPD-Adobe: "4.3"
*%
*% "$Id: pdf.ppd,v 1.3 2003/01/02 23:32:42 gurubert Exp $"
*%
*%   Printer description for a printer that uses the pstopdf filter
*%
*%   This file is based on the laserjet.ppd that comes with CUPS.
*%
*FormatVersion:	"4.3"
*FileVersion:	"1.1"
*LanguageVersion: English 
*LanguageEncoding: ISOLatin1
*PCFileName:	"PDF.PPD"
*Manufacturer:	"Robert Sander <[email protected]>"
*Product:	"(CUPS v1.1)"
*cupsVersion:	1.1
*cupsManualCopies: False
*% add these two lines
*cupsFilter: "application/vnd.cups-pdf 0 -"
*cupsFilter2: "application/pdf application/vnd.cups-pdf 0 pdftopdf"
*% comment this out
*% *cupsFilter:	"application/vnd.cups-postscript 33 pstopdf"
*ModelName:     "PDF Converter"
*ShortNickName: "PDF Converter"
*NickName:      "PDF Converter CUPS v1.1"
*% rest of the ppd ... 

The result of this change is a PDF in your mailbox with better font smoothing

invoice_header

And the original fonts that PostBooks embeds are still in the document

properties_embedded_fonts

And better still you can copy and paste without the nasty symbols as can be seen from the block of readable pasted text contrasted with the original PDF's mangled garbage

copy_and_paste_no_name_embedded

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.