# How to embed fonts at compile time with pdflatex

I just ran into the problem of embedding fonts while trying to publish with lulu.com. Although everyone apparently is 'supposed' to handle those 35 standard fonts for some strange reason they won't accept pdf's without them included. So one way that according to Daniel Lemire's blog is supposed to work (I haven't tried yet, but hopefully it does work) is to convert the pdf to ps and then back to pdf and include the fonts at that time:

pdftops file.pdf
ps2pdf14 -dPDFSETTINGS=/prepress file.ps


But this feels at least to me like the wrong way of doing things. Is there some way of passing the parameter directly to pdflatex to tell it to embed those fonts?

And, if not -- How do we go about getting such a feature? (Because it can't only be me who has this sort of problems)

-
PS->PDF->PS is definitively the wrong way to do it. I cannot understand your problems with this. In my PDFs all fonts are embedded (at least I get a 'embedded subset' with all listed fonts). I submitted several papers created with pdfLaTeX without any special settings to IEEE which are fussy about embedding fonts as well and it always passed their tests. –  Martin Scharrer Feb 6 '11 at 13:53
Most TeX distributions are set up to embed all fonts. Does your document have included images? If so, they may be the source of the problem. If you compile your document with the [draft] option, are the fonts embedded? Then your problem is with the images not the document itself. –  Alan Munn Feb 6 '11 at 14:06
Yes @Alan is right: If you include other PDF or EPS files as images which use other fonts but not include them by themselves, then the final PDF will miss this fonts. I now remember a colleague of mine having this problem once. –  Martin Scharrer Feb 6 '11 at 14:20
@jonalv: it is a known problem that often the default PostScript fonts are not embedded into an eps image, because tehy are already present in PostScript printer. For dvi files you have to use a special config file, which includes the base files. However, every printer company should be able to replace the missing fonts. –  Herbert Feb 6 '11 at 18:51
@jonalv: You can check for non-embedded fonts in your PDF images using pdffonts or Acrobat Reader (or another PDF viewer). In Acrobat Reader go to File->Properties->Fonts and look if all listed fonts are marked with (embedded subset) or (embedded) etc. You might just have tell every author to do this with his/her PDF images. Once you tracked down the bad ones try to re-create them with the fonts embedded. AFAIK you cannot embed them later with latex. –  Martin Scharrer Feb 6 '11 at 18:52

Make sure the pdftexDownloadBase14 settings in the updmap.cfg file is set to true to make pdflatex to embed the base 14 pdf fonts. If you use normal latex then you should set dvipdfmDownloadBase14 to true. Best set both. On my TeXLive 2010 installation it is already set to true and I had never issues with my IEEE paper submissions.

You can edit this config file by running updmap --edit (under Linux most likely as root using sudo beforehand; not sure about M$Windows). Here the explanation from the updmap.cfg file: # pdftexDownloadBase14 # # Should pdftex download the base 14 pdf fonts? Since some configurations # (ps / pdf tools / printers) use bad default fonts, it is safer to download # the fonts. The pdf files will get bigger, though. # Valid settings are true (download the fonts) or false (don't download # the fonts). Adobe recommends embedding all fonts. pdftexDownloadBase14 true  Also make sure that PDF or EPS files you include as images include all their fonts by themselves. This can be an issue if you generate these PDF or EPS images from e.g. M$ Office like Visio, because they use most definitive different fonts. AFAIK LaTeX can not include this missing fonts because they are not part of the main document but of the embedded object (image). The only solution here is to embed the fonts to them first, either by re-generate them with the correct settings in the software you use for this (e.g. PDF printer) or by running the ps2pdf14 command you mentioned on the images beforehand not the final document.

-
@jonalv: This seems also be recommend by a different post in the blog mentioned by you. –  Martin Scharrer Feb 6 '11 at 14:05
Yes I have seen this. Thing is, my question was if there is a way to set that value by sending a pameter to pdflatex? I want to be able to run this on a vanilla installation of LaTeX by just running a Makefile... –  jonalv Feb 6 '11 at 18:48
@jonalv: I don't think so, at least not without editing updmap.cfg from the Makefile :-) Most "vanilla installation" of LaTeX should have this enabled anyway. It seems that your problem are the PDF images. –  Martin Scharrer Feb 6 '11 at 18:59
can someone perhaps think of an easy way to figure out which pdf figures that are lacking the correct fonts? Can LaTeX help with that? –  jonalv Feb 11 '11 at 11:15
@ManuelKuehner: I don't know, but I wouldn't think that pdftex embeds the base fonts also in the included PDF image. However, it should be possible to include them with Ghostscript. Please search for that on this site and post a new question for it if you can't find one. –  Martin Scharrer Mar 19 at 17:17

I know this is an old topic, but I stumbled across it while searching for a solution. I found one, so I share it with you. I usually embed pdfs generated by R. Unfortunately R also doesn't embed the fonts. Processing the output of LaTeX with ghostscript will preserve all the links in the document:

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dEmbedAllFonts=true -sOutputFile=$YOUR_OUTPUT_FILE.pdf -f$YOUR_INPUT_FILE.pdf

One could also add -dNOPLATFONTS to the command line to use the ghostscript versions of the standard pdf fonts like Palatino, Times and Helvetica, if the ones installed on the system don't have all the characters needed in the specific document.

-
Any idea how you would embed the fonts from an R file in Windows? –  Jean-Sébastien Apr 24 at 19:51