Monday, March 14, 2011

Embed fonts in PDF file using PDFLaTex

Download: Fast, Fun, Awesome

This post explains how to embed fonts in PDF file.
Embedding the font in the PDF file is useful when you are preparing a paper for conference submission or you want to ensure that your PDF file looks exactly same on other's machine as it does on your computer. 
In this post I will explain how to do it on Linux machine.  I am not sure how to achieve the same on Windows computer. 
We will use tool "pdffonts" to examine PDF file. 

$ pdffonts  mypaper.pdf
name                                                              type                emb  sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
HVGYIY+NimbusRomNo9L-Medi             Type 1            yes   yes no     110  0
TFVQMQ+NimbusRomNo9L-Regu            Type 1            yes   yes no     111  0
XHGNKU+NimbusRomNo9L-MediItal       Type 1            yes   yes no     113  0
UUGCZC+NimbusRomNo9L-ReguItal        Type 1            yes   yes no     114  0
FDULPW+CMSY7                                        Type 1            yes   yes no     148  0
SPCNWZ+NimbusMonL-Regu                     Type 1            yes   yes no     150  0
ABCDEE+Times                                           TrueType        yes   yes no     152  0
Arial                                                              TrueType          no   no  no     153  0
Arial                                                          CID TrueType      yes  no  yes    154  0
Arial                                                               TrueType          no  no  no     220  0
Arial                                                          CID TrueType      yes  no  yes    221  0
ABCDEE+Times                                         TrueType          yes  yes no     222  0
Arial,Italic                                                     TrueType          no   no  no     223  0
ZLLMAJ+CMMI10                                       Type 1            yes  yes no     257  0
Arial                                                              TrueType          no   no  no     259  0
ABCDEE+Calibri                                        TrueType          yes  yes no     260  0
Arial,Italic                                                     TrueType          no   no  no     261  0
Arial                                                             TrueType          no   no  no     282  0
Arial,Italic                                                    TrueType          no   no  no     283  0

$

The important columns are name and emb.  The "name" column displays the name of the font and the "emb" column shows whether that font is embedded in your PDF file or not. "yes" is "emb" column indicates that the font is embedded in the PDF file and "no" indicates that the font is not embedded in the PDF file.  
For example, in the above oputput, Arial, and Arial,Italic fonts are not embedded in the PDF file.

To embed the un-embedded fonts into your PDF file using PDFLaTex:
$  updmap --edit 
The above command will open the configuration file for pdflatex.
Find the pdftexDownloadBase14 directive and make sure it is true. That is, when you're done, the following line should be in the file:
pdftexDownloadBase14 true

Save the file and rebuild your PDF file using "pdflatex". 
Then check your PDF file using "pdffonts" command. It should now have embedded all the fonts use in your PDF file. 
If there are still some fonts missing then it might be because your have embedded another pdf file (as a graphics) into your "mypaper.pdf" file. 
In that case, you need to embedded the fonts into those embedded PDF files as well. 

If you included figures in your PDF file then follow the steps given below:
1.  Convert your PDF file to PS file
  $ pdftops  mypaper.pdf

2. Convert back ps file to pdf using "prepress" settings
  $ ps2pdf14 -dPDFSETTINGS=/prepress mypaper.ps


Conversion from PDF to PS and again back from PS to PDF my cause some formatting errors. I recommend you to double check your PDF file for formatting errors. 


3. Check PDF fonts using pdffonts command
  $ pdffonts mypaper.pdf

No comments:

Post a Comment