44

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)

jonalv
  • 11,466
  • 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 06 '11 at 13:53
  • 6
    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 06 '11 at 14:06
  • 2
    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 06 '11 at 14:20
  • And this is the problem that the posted link describes. So the solution of conversion from pdf -> ps -> pdf is meant only as a workaround for image files that have this problem, not for the whole document. – Alan Munn Feb 06 '11 at 14:39
  • Thanks @Alan, I didn't got that first. I updated my answer accordantly. – Martin Scharrer Feb 06 '11 at 15:02
  • @jonalv: do you have some images included which were converted from eps to pdf? In some cases they cannot have the standard PotsScript fonts included, e.g. like Helvetica. Then they are also missing in the pdf –  Feb 06 '11 at 16:05
  • Yea it's a 400 pages book with multiple authors so yea there is definitly a lot of different image sources. Most probably there might be font troubles in them. – jonalv Feb 06 '11 at 18:45
  • 1
    @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. –  Feb 06 '11 at 18:51
  • 3
    @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 06 '11 at 18:52

3 Answers3

26

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.

Martin Scharrer
  • 262,582
  • @jonalv: This seems also be recommend by a different post in the blog mentioned by you. – Martin Scharrer Feb 06 '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 06 '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 06 '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
  • @jonalv: You can use the pdffonts program to print a list of all fonts, incl. if they are embedded or not. However, I can't tell you if it is available for MS Windows. See also my last comment below your questions. – Martin Scharrer Feb 11 '11 at 11:56
  • @Martin Scharrer: In my case I have a PDF image created with an external software (R, statistic software). The fonts are not embedded. Does your answer also work with PDF pictures - I mean has the PDF document with the included PDF pictures all the fonts embedded (even the base fonts)? – Dr. Manuel Kuehner Mar 19 '14 at 07:47
  • 1
    @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 '14 at 17:17
  • Does this do the edit for Miktex on windows? initexmf --edit-config-file updmap – imriss Jan 14 '15 at 18:40
  • @imriss: Sorry, can't say. – Martin Scharrer Jan 14 '15 at 23:35
20

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.

17

Unfortunately Tobias' approach didn't work for me when trying to embed fonts in my images for use with pdfTeX. The following command line, based on an answer from StackOverflow did work for me:

 gs -dCompatibilityLevel=1.4 \
    -dPDFSETTINGS=/screen \
    -dCompressFonts=true \
    -dSubsetFonts=true \
    -dNOPAUSE \
    -dBATCH \
    -sDEVICE=pdfwrite \
    -sOutputFile=image_with_fonts.pdf \
    -c ".setpdfwrite <</NeverEmbed [ ]>> setdistillerparams" \
    -f image_without_fonts.pdf
taltman
  • 271
  • Welcome to TeX.SX! – Heiko Oberdiek May 25 '15 at 04:44
  • 1
    I tried both Tobias' and taltman's approaches. Tobias' worked partially, but there were still some that failed to embed. This solution (taltman's) embedded all fonts for me. – sammy34 Jun 07 '16 at 13:55
  • 1
    Coming back to this answer again for my latest paper, I had to change -dPDFSETTINGS=/prepress in the above to prevent other images in the PDF from becoming low quality. See http://milan.kupcevic.net/ghostscript-ps-pdf/ – sammy34 May 30 '17 at 20:10
  • Thanks @sammy34, -dPDFSETTINGS=/prepress also fixed the low quality image problem for me. – Markus Weninger Feb 26 '18 at 13:46