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

Nasicus 11-20-2012 07:13 AM

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

I'm getting crazy over here, I already googled my a** off but didn't find an answer.

Following scenario:

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/.fonts folder
- Copied it in the /usr/share/fonts
- With root: SuSEconfig --module fonts
- fc-cache
... are just some varous things I tried during googling.

Anyway when I try to print the pdf with the command:
lpr -PHL2400Ce -o -# 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 already see the OCRB font in the viewer 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?

Thanks for your time.

business_kid 11-21-2012 03:34 AM

there's level 1 - level 3 pdfs, and the number of fonts you have goes up. Make sure you're set for level 3 all along. Check you have the font in /usr/share/ghostscript/fonts or some similar place. An if at first you don't succeed - give up. Embed the fonts always as this sort of thing is wearing.

Nasicus 11-21-2012 04:33 AM

The problem is "its not in my power" to embed the font ;)
I copies the ttf font in the /usr/share/ghostscript/fonts doesnt help though :S

business_kid 11-21-2012 08:56 AM

you need to rerun mkfontalias, mkfontscale, & mkfontdir after adding a font, and a ttf will be ignored by ghostscript. Try this and make it a pfm or something. That might help.

Nasicus 11-28-2012 01:29 AM

Thanks for pointing me in the right direction.

I did the following now:

I used to convert the ttf into a .pfb.
I copied the pfb into /usr/share/ghostscript/fonts/
I added the following line to the fontmap file (located at /usr/share/ghostscript/<gsversion>/lib/Fontmap):
/OCRB (/usr/share/ghostscript/fonts/ocrb.pfb);

Then I used the following command to embedd the font:

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

When I print via lpr the font is now correct... but I have a new problem, the "margins" on the paper are not the same.
When I print it via lpr everything is like 1 cm displaced (to the bottom), but when I print (the same pdf) with adobe (on windows) its correct.
Any advise on that?

business_kid 11-28-2012 05:01 AM


change or omit that. There are also fancy options to lp and lpr. But most of this stuff is 20 years old and thwe best advice is to read man pages and try stuff. Apply patience.

All times are GMT -5. The time now is 07:41 AM.