For fonts, you can use pdffonts:
$ pdffonts charismanie.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
BQFNPY+TimesNewRomanPS-ItalicMT CID TrueType yes yes yes 59 0
UQUJMH+Centennial-Roman CID TrueType yes yes yes 60 0
NSOUSR+LinLibertine Type 1 yes yes no 137 0
NSOUSR+LinLibertine Type 1 yes yes no 138 0
PTKESR+LinLibertineI Type 1 yes yes no 143 0
TYFIDZ+CMSY10 Type 1 yes yes no 144 0
MHUAJQ+LinLibertineB Type 1 yes yes no 145 0
[none] Type 3 yes no no 146 0
QTAYVE+LinBiolinumB Type 1 yes yes no 161 0
CXJGOW+CMR12 Type 1 yes yes no 207 0
PTKESR+LinLibertineI Type 1 yes yes no 285 0
PFIFSH+fourier-orns Type 1 yes yes no 465 0
Edit: pipitas provided a nice answer with the -f and -l options for pdffonts. In order to automate his suggestion a bit more to list fonts in a PDF, here is a little script:
#!/bin/bash
# Parse options
RANGE=0
while getopts ":ap:f:l:g:" option; do
case $option in
a)
RANGE=1
;;
p)
RANGE=1
STARTPAGE=$OPTARG
ENDPAGE=$STARTPAGE
;;
f)
RANGE=1
STARTPAGE=$OPTARG
;;
l)
RANGE=1
ENDPAGE=$OPTARG
;;
g)
GREP=1
KEYWORD=$OPTARG
;;
*)
echo "Unknown option $option"
exit 1
;;
esac
done
shift $(($OPTIND - 1))
PDF="$1"
if [ -z "$PDF" ]; then
echo "E: You must provide a PDF file"
exit 1
fi
PAGES=$(pdfinfo $PDF | awk '/^Pages:/ { print $2 }')
if [ $RANGE = 1 ]; then
for p in $(seq ${STARTPAGE:-1} ${ENDPAGE:-$PAGES}); do
echo "== Fonts on page $p/$PAGES =="
pdffonts -f $p -l $p $PDF
done
elif [ $GREP = 1 ]; then
FOUND=""
for p in $(seq ${STARTPAGE:-1} ${ENDPAGE:-$PAGES}); do
pdffonts -f $p -l $p $PDF | grep -q "^${KEYWORD} " && \
FOUND="$FOUND $p"
done
if [[ -n $FOUND ]]; then
echo "The font $KEYWORD was found on the following pages:$FOUND"
else
echo "The font $KEYWORD was not found"
fi
else
pdffonts $PDF
fi
It is a bash script, to be used on *nix systems. Here, I saved it as showfonts.sh).
Here is what it does:
- Without any options, it just executes
pdffonts on the given PDF file;
The -a option (for all) does what pipitas suggested: it lists fonts on every page individually, e.g.:
$ ./showfonts.sh -a charismanie.pdf
The -p option (for page) lists fonts on a specific page of the PDF, e.g.:
$ ./showfonts.sh -p 15 charismanie.pdf
The -f and -l options (for first and last) are the equivalent of the same options in pdffonts (so -f 1 is equivalent to -a), e.g.:
$ ./showfonts.sh -f 13 -l 16 charismanie.pdf
The -g option (for grep) lets you find on which pages a font is used, e.g.:
$ ./showfonts.sh -g "LeagueGothic" charismanie.pdf
It also also takes wildcards to match fonts with similar names, e.g.:
$ ./showfonts.sh -g ".*Libertine.*" charismanie.pdf
This script is now committed on github: https://github.com/raphink/listpdffonts
Edit: The script now supports font subsets with -g as requested by Kurt Pfeifle. See Git repository.