How to embed all fonts in a PDF document generated with LaTex

Last updated on June 27, 2020 by Dan Nanni

Question: I generated a PDF document by compiling LaTex source files. However, I noticed that not all fonts used are embedded in the PDF document. How can I make sure that all fonts are embedded in a PDF document generated from LaTex?

When you create a PDF file, it is a good idea to embed fonts in the PDF file. If you don't embed fonts, a PDF viewer can replace some fonts with alternative ones if they are not available on the computer. This will cause the document to be rendered differently across different PDF viewers or OS platforms. Missing fonts can also be an issue when you print out the document.

When you generate a PDF document from LaTex (for example with pdflatex or dvipdfm), it's possible that not all fonts are embedded in the PDF document. For example, the following output of pdffonts says that there are missing fonts (e.g., Helvetica) in a PDF document.

To avoid this kind of problems, here is how to embed all fonts at LaTex compile time.

$ latex document.tex
$ dvips -Ppdf -G0 -t letter -o document.ps document.dvi
$ ps2pdf -dPDFSETTINGS=/prepress 
-dCompatibilityLevel=1.4 
-dAutoFilterColorImages=false 
-dAutoFilterGrayImages=false 
-dColorImageFilter=/FlateEncode 
-dGrayImageFilter=/FlateEncode 
-dMonoImageFilter=/FlateEncode 
-dDownsampleColorImages=false 
-dDownsampleGrayImages=false 
document.ps document.pdf

Now you will see that all fonts are properly embedded in the PDF file.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean