Printing PDF with not embedded TrueType Font (cups / lpr)

cupsfontspdfprinting

I have a PDF in which the TrueType font OCRB is used, however the font is not embedded.

So I tried to install the font on my system (which is by the way a SLES11 SP2), I did the following things:

  • Double Clicked the font on gnome Desktop and clicked install
  • Copied it in the /user/home/username/.fonts folder
  • Copied it in the /usr/share/fonts
  • With root: SuSEconfig --module fonts
  • fc-cache

When I try to print the .pdf with the command:

lpr -PHL2400Ce -# 1 test.pdf

The .pdf prints just fine, but the OCRB font is gone and replaced with the standard one.

However, when I open the .pdf with evince (gnome Document viewer) I see the OCRB font in the viewer (correct) and when I print it (with the same printer) its there and absolutely correct.

I don't understand this because I guess evince also uses lpr in some way? Any ideas what I can do? (It is very important for me being able to print the .pdf via command line, since it's gonna be part of batch jobs which runs in background)

I also tried some approaches like this:

gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=output2.pdf -f test.pdf

Which brings me the output:

....
Can't find (or can't open) font file Arial-BoldMT. 
Didn't find this font on the system!
Substituting font Helvetica-Bold for Arial-BoldMT.
Substituting font Helvetica for OCRB

So what I see here is, that gs substitutes Helvetica for OCRB even though there is no message Can't find or can't open font... as it is for Arial-Bold. Any idea why?

Best Answer

You need to add the font in the printer renderer as well. The correct folder for printer renderer font libraries is a tough bird to find, but looking through all of CUPS/Ghostscript/lpr configuration you'll find the place. The fonts might need reindexing and there are scripts for that in both CUPS and GS.

Why Evince printed it out nicely is that with slight coercion you basically told it to prerender all stuff as vectors.

This is a bit unnecessarily complex mostly because these modular parts were born separately and the converging that happens at system level has happened only recently.

Apple uses CUPS internally and has solved the font installing issue somehow. I've not checked into the details but basically it either uses a central systemwide font library or copies the fonts to both GUI and CUPS font paths. I'm guessing they don't copy but have changed the softwares to support a common font path.

Related Question