Checking for embedded fonts in an exported PDF

I use Apple Pages extensively to create documents. I really love it. It produces polished results that you just can’t get out of Word without considerable effort. I was having an issue with another tool that didn’t seem to be rendering ligatures and other special characters (smart single & double quotes, umlauts etc). It would render them in some kind of default font. I was told that the tool renders fonts correctly so long as they’re embedded in the PDF.

Finding out if the rendered PDF has its fonts embedded isn’t hard, right? Well, if you are adverse to installing Adobe malware software like I am, it gets more complicated.

The bottom line is that when rendering a PDF with macOS’ built-in engine, you’ll get embedded fonts. How do I know that? After some digging around, I found this post on Apple’s forums. ¬†Create this shell script:

#!/bin/bash 
# 
# print font names found in PDF written by OS X Quartz PDFContext 
usage () { 
 printf "Usage:\n" 
 printf "pdf-fonts.sh filename-1.pdf filename-2.pdf\n" 
 printf "pdf-fonts.sh *.pdf\n" 
 exit 1 
} 
for f in "$@" 
do 
#output sorted uniq font names 
unset GREP_OPTIONS 
printf "\n=== %s ===\n" "$f" 
egrep -a -o '\+\b(.*\s)\b' "$f" | cut -d '/' -f1 | sort -u 
[[ $? > 0 ]] && usage 
done 
exit 0

By feeding that script the file name of my questionable PDF, I got this:

 

 

Whelp, there you have it. macOS Sierra embeds PDFs without any shenanigans (including old tricks like File -> Print and selecting PDF).

Time to file a bug on that tool…