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

5,940

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.

Share:
5,940

Related videos on Youtube

tenhouse
Author by

tenhouse

Updated on September 18, 2022

Comments

  • tenhouse
    tenhouse over 1 year

    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?

    • sr_
      sr_ over 11 years
      To have evince print via lpr, add the line gtk-print-backends="pdf,cups,lpr" to your ~/.gtkrc-2.0. By default, it's using CUPS directly. Not sure what your lpr is (CUPS' compat clients?), and how it works (i.e. how could you do what evince does from the command line), sorry.
    • tenhouse
      tenhouse over 11 years
      Sorry I don't understand why I should do this? I mean evince is printing correctly, I just wanted to give "proof" that the truetype font is corrctyl installed and also working, but not from command line. Or do you mean I should add the line just for "testing" purposes? Btw: I don't need to do exactyl what evince does, I just want the true type font to be printed with a command line print (I also don't care if its lpr or another command I have to use).
    • sr_
      sr_ over 11 years
      I suspect evince does not use lpr under the hood unless you make it do this, so, yes, testing purposes :)
    • tenhouse
      tenhouse over 11 years
      ok I added the line (and created the file since it was inexistent), when I opened evince and clicked print I had a new option "Print with lpr" when I chose it and entered the command lpr -PHL2400Ce it also printed correctly (with the OCRB)
    • S edwards
      S edwards about 10 years
      Enjoy the almighty Unicorn upvote !