CUPS-PDF Printing Images not searchable PDF

Written by James McDonald

January 27, 2020

I have a cups-pdf printer that takes the output from glabels-3-batch

# Using glabels-3-batch results in a PDF you can select and copy the text from
cat merge.csv | glabels-3-batch -i - -o out.pdf 100x50sample.glabels

The PDF file which glabels-3-batch creates can be opened in Adobe Reader and the text can be copied and pasted

But when I went the next step and and passed it through Cups-PDF I got a PDF that had been converted into an image

# this created an image that you can't copy and select text from
# step 1 - create a PDF using glabels-3-batch
cat merge.csv | glabels-3-batch -o out.pdf -i - 100x50sample.glabels

# step 2 - send to cups-pdf printer
# creates a PDF image
lpr -PPDF out.pdf

I found a fix. You need to add an option to your /etc/cups/printers.conf for the CUPS-PDF queue:

How to configure Cups-PDF for searchable text output

First make sure you have poppler-utils installed as this contains the necessary cairo utility

apt-get install poppler-utils

Next stop cups and then add Option pdftops-renderer pdftocairo to your /etc/cups/printers.conf and restart cups

# Printer configuration file for CUPS v2.2.7
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<Printer PDF>
UUID urn:uuid:d679f6dc-050c-3026-6287-eca3fb996187
Info PDF
Location 
MakeModel Generic CUPS-PDF Printer (w/ options)
DeviceURI cups-pdf:/
State Idle
StateTime 1580115111
ConfigTime 1580115023
Type 8450124
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
# add this line
Option pdftops-renderer pdftocairo
</Printer>

Following are images of what you see when you have default CUPS-PDF installed and then with the pdftocairo option set

Document Properties when CUPS-PDF outputs Images without selectable / accessible Text

Fonts tab is completely empty

Document Properties when CUPS-PDF is configured to use pdftocairo which outputs PDF that allows text selection and copying

Note that now fonts are embedded and you can select and copy text from the CUPS-PDF printed PDF file

0 Comments

Submit a Comment

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

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...