It is more difficult to look at the fonts in a PDF document than it is in Word. Here is how you can do it using pdffonts.
Choosing the right font for your documents can be difficult if you don’t know much about typography and design. But if you have a document with a font you like, you can easily extract the name of the font via the command line. All you need is a tool called pdffonts.
In this article, you will learn about pdf fonts and how to install them on your computer. You will also find a detailed guide on how to identify fonts in a PDF document using it.
What is pdffonts?
Pdffonts is a command line utility used to extract useful information about fonts into a PDF file. You can get the following details using pdffonts:
Type of font.
Information about the subset.
The object ID of the font.
Since pdffonts is part of the Poppler library, you will need to install the full suite of utilities to be able to use pdffonts. Poppler is a free library used to efficiently render and analyze PDF files.
To install pdffonts on Debian and Ubuntu:
sudo apt install poppler-utils
On Arch Linux:
sudo pacman -S poppler
On Fedora, CentOS, and other RHEL-based distributions:
sudo dnf install poppler-utils
How to analyze fonts in a PDF
Pdffonts comes with several options to get information about the name and type of the font used in the PDF file.
The basic command syntax is:
pdffonts option pdffile
…or option is the flag that invokes the different methods of the command, and PDF file is the absolute or relative path of the PDF file.
When you run the pdffonts command, it reads the xpdfrc configuration file in the home directory. If the file is not found, it searches for the system-wide configuration file located at / usr / local / etc.
The simplest pdffonts command includes only the name of the file. For example, to check the fonts used in the mannequin lorem-ipsum.pdf deposit:
Pdffonts will generate output similar to the one below:
You can see that the output includes the following information: Font Name, Font Type, Encoding, Integration Details, Subset Information, Unicode, and Object ID.
Analyze a range of pages
the -F and -l Flags are useful if you want to extract the font details for a specific page or range of pages. Simply specify the page number along with the options as follows:
pdffonts -f 1 -l 3 lorem-ipsum.pdf
The aforementioned command will only provide the font information for pages one through three. To process the first page of a PDF file using pdffonts:
pdffonts -f 1 -l 1 lorem-ipsum.pdf
Using pdffonts, you can even get font information from password protected PDF files using the -opw and -upw flags. These flags represent owner password and user password respectively.
Enter the following command to process a password protected PDF file. Be sure to replace the password with the password of the file.
pdffonts -opw password lorem-ipsum.pdf
pdffonts -upw password lorem-ipsum.pdf
Pdffonts will automatically bypass the authentication process using the password provided.
Working with PDF files in Linux
Pdffonts is a great utility if you regularly create and edit PDF files on your Linux system. It provides information about the font name, font type, and encoding format for all fonts used in the file.
If for some reason you are unable to use the pdf fonts on your computer, try converting the PDF file to images. Then you can just extract the font details from the image using a font analysis web app. Alternatively, if you can’t decide which font to use, you can use the built-in font packs available in Linux PDF editors.
If you are worried about the amount of data Google collects, you can use DuckDuckGo. But on Chrome, is it even private?
About the Author