This is a cups-pdf v3.0.1 with a patch to allow printing text as text, not as images. This issue is also known as "cups-pdf not embedding text", or "producing large PDFs with text that can not be searched"
This is fix is achieved by adding PDF passthrough functionality, so incoming PDFs remain PDFs, instead of being converted from PDF to PostScript, then back to PDF. Why is this fix not in the original code? The author had different goals for CUPS-PDF in mind, refusing to fix it.
- You can do post-processing, for example choose pdf filename and saving location in a standard file save dialog, and automatically open generated PDF.
- Use PDF printing from non GTK/QT apps, like Wine
- Provide consistent PDF printing experience
There is a cups-pdf version 2.6.1 with the fix in an easy to install deb patch form in ppa:jethrogb/ppa. Add it to your list of apt sources and update. For Arch Linux you can find it in AUR: cups-pdf-to-pdf-git
For all the other system, or if you want the latest functionality follow the directions below:
- Get the development prerequisites
apt-get install libcups2-dev
- Compile
gcc -O9 -s -o cups-pdf cups-pdf.c -lcups
(note the different order of options than the one suggested on the cups-pdf website)
- Copy to your system folder
sudo cp /usr/lib/cups/backend/cups-pdf /usr/lib/cups/backend/cups-pdf.bak
sudo cp cups-pdf /usr/lib/cups/backend/
- Copy CUPS-PDF_opt.ppd to your CUPS model directory
sudo cp CUPS-PDF_opt.ppd /usr/share/cups/model
- Copy cups-pdf.conf to /etc/cups (and then edit as needed):
sudo cp cups-pdf.conf /etc/cups/
- Remove CUPS-PDF printer, if you have any, and recreate it. Make sure to pick "Generic CUPS-PDF Printer (w/ options)" as the driver
If you create the printer with the URL like this: cups-pdf://localhost, then it will be looking for a file cups-pdf-/localhost.conf Change the URL to cups-pdf:/ (it is a valid url after it's created, but you might not be able to use it during creation). It will then look for cups-pdf.conf
sudo vi /etc/apparmor.d/usr.sbin.cupsd
- At the end of the
/usr/sbin/cupsd flags=(attach_disconnected)
section add
unix peer=(label=/usr/lib/cups/backend/cups-pdf),
signal peer=/usr/lib/cups/backend/cups-pdf,
- At the end of the
/usr/lib/cups/backend/cups-pdf
section add
/var/log/cups/ r,
/var/log/cups/** rwk,
/etc/cups/ r,
unix peer=(label=/usr/sbin/cupsd),
signal peer=/usr/sbin/cupsd,
@{HOME}/bin/pdfpostproc.sh rUx,
(last line is needed if you indicated a post-processor in your /etc/cups/cups-pdf.conf)
- Reload apparmor profile
sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.cupsd
- For other issues refer to the original README or the original documentation
- Kudos to Björgvin Ragnarsson for the patch to CUPS-PDF v2.6