
pdffonts Command in Linux
The pdffonts command in Linux analyzes the fonts in a PDF file. It displays a list of the fonts used in a PDF file, along with detailed information about each font. This tool is helpful for examining which fonts are embedded in a PDF, their types, encoding, and more.
Table of Contents
Here is a comprehensive guide to the options available with the pdffonts command −
Syntax of pdffonts Command
The syntax of the Linux pdffonts command is as follows −
pdffonts [options] [PDF-file]
The [options] field is used to specify various options, and the [PDF-file] field is used to specify a PDF file that needs to be analyzed.
pdffonts Command Options
The options of the pdffonts command are listed below −
Options | Description |
---|---|
-f <number> | Specifies the first page to analyze |
-l <number> | Specifies the last page to analyze |
-opw <password> | Provides the owner password for the PDF file, allowing you to bypass security restrictions |
-upw <password> | Provides the user password for the PDF file |
-v | Displays version and copyright information |
-h | Displays usage instructions (equivalent to -help or --help) |
Examples of pdffonts Command in Linux
This section demonstrates the usage of the pdffonts command in Linux with examples −
Listing Font Information in a PDF File
Execute the following command to list font details in a PDF file −
pdffonts file.pdf

The above output shows the following information −
Columns | Description |
---|---|
name | The name of the font |
type | The type of the font such as TrueType, Type1, CID Type 0 |
encoding | Encoding used by the font such as Builtin, Custom, Identity-H) |
emb | Indicates whether the font is embedded in the PDF (yes or no) |
sub | Indicates whether the font is a subset (yes or no) |
uni | Indicates whether the font has a ToUnicode mapping (yes or no) |
object ID | The object ID of the font in the PDF file |
Analyzing Specific Pages of PDF File
To analyze the specific pages of a PDF file, use the -f and -l options with the pdffonts command. For example, to analyze fonts from pages 3 to 7, use the command in the following way −
pdffonts -f 3 -l 7 file.pdf

Working with Password Protected PDF Files
If the PDF requires a user or owner password, then it can be specified by using the respective option. The user password restricts access to opening the PDF, while the owner password controls permissions like editing, printing, or copying and can override all restrictions.
To specify the user password for the PDF file, use the -upw option −
pdffonts -upw userpassword file.pdf
Similarly, to specify the owner password for the PDF file, use the -opw option with the pdffonts command −
pdffonts -opw ownerpassword file.pdf
Displaying Help
To display help related to the pdffonts command, use the -h option −
pdffonts -h
Conclusion
The pdffonts command in Linux is a utility for analyzing the fonts used in a PDF file. It provides detailed information such as font names, types, encoding methods, and whether the fonts are embedded or subsets. This tool is useful for inspecting specific pages of a PDF, handling password-protected files, and understanding font-related details.
In this brief tutorial, we explained the pdffonts command, its syntax, options, and usage in Linux with examples.