This repository contains two bash scripts, fontcheck
and fontembed
, that can be used to check for embedded fonts in a PDF file and to embed fonts if they are not already embedded. These scripts are particularly useful for ensuring that all fonts are embedded in your manuscript before submitting it to conferences and journals.
Before using these scripts, you need to install the following tools on your macOS system:
poppler
orxpdf
for checking fonts in PDF files.ghostscript
for embedding fonts in PDF files.
You can install these tools using Homebrew:
brew install poppler
brew install ghostscript
-
Clone this repository to your local machine:
git clone https://github.com/huwan/pdf-font-embedder.git cd pdf-font-embedder
-
Copy the scripts to
/usr/local/bin
:sudo cp fontcheck /usr/local/bin sudo cp fontembed /usr/local/bin
-
Make the scripts executable:
sudo chmod +x /usr/local/bin/fontcheck sudo chmod +x /usr/local/bin/fontembed
To check if fonts are embedded in a PDF file, use the fontcheck
script:
fontcheck file1.pdf file2.pdf ...
or
fontcheck *.pdf
This will output the font information for each PDF file specified.
To embed fonts in a PDF file, use the fontembed
script:
fontembed file1.pdf file2.pdf ...
or
fontembed *.pdf
This will embed fonts in each PDF file specified and overwrite the original file.
# Check fonts in a PDF file
fontcheck sample.pdf
# Embed fonts in a PDF file
fontembed sample.pdf
Special thanks to the developers of poppler
, xpdf
, and ghostscript
for their invaluable tools.