Designed to show information about a Portable Document Format (PDF) document fonts and other metadata information.
Three basic commands:
pdffontetc-display-metadata-org-style- Display PDF metadata in a separate buffer in Org-mode style.pdffontetc-display-font-information- Show information about the fonts used in a PDF. [Optionally includes explanatory information if called with prefix argument. I.e., if command is preceded byC-u.]pdffontetc-display-combined-metadata-and-font-info- Show both of the above in the same temp buffer. [Same optional prefix behaviour as 2.]
PDF with lots of metadata & fonts0
Requires the pdffonts utility from Poppler, which is the same PDF toolsuite that the Emacs PDF Tools package uses. And you ideally are also using the PDF Tools package.
Now, initial experimental support has also been added showing information from exiftool, which can access additional potentially important additional PDF information, like PDF/UA.1
The metadata command is more or less functionally equivalent with the one already in PDF Tools (in pdf-misc.el), but displays using Org-mode styling.
The PDF Tools metadata functionality has been around for a while, and I often use it. I was frustrated because I wanted to be able to see information about fonts as well, and would always have to drop out to a terminal to get this information. Now I don’t have to anymore.
You may want to shadow PDF Tools’ pdf-misc-minor-mode map in your init, or otherwise add convenient keybindings (maybe under :config in your use-package):
(defun pdffontetc-extra-keys ()
"Set some additional keybindings in PDF-Tools for pdffontetc info functions."
;; `O' for `Org-style' Info, = pdf metadata in orgish display:
(local-set-key (kbd "O") #'pdffontetc-display-metadata-org-style)
;; `T' for `Typeface', i.e., Font info [since `F' is already taken]:
(local-set-key (kbd "T") #'pdffontetc-display-font-information)
;; `U' for `Unified' info, i.e., both Metadata and Font info:
(local-set-key (kbd "U") #'pdffontetc-display-combined-metadata-and-font-info))
(add-hook 'pdf-view-mode-hook #'pdffontetc-extra-keys)You can install this package from Melpa, including via `use-package`, e.g.:
(use-package pdffontetc
;; :ensure t ; maybe, depending on your use-package setup)Clone this repo or copy the pdffontetc.el file somewhere and load it via init.el, e.g., copy to ~/.emacs.d/lisp/pdffontetc/ and put in your init.el:
(add-to-list 'load-path
"~/.emacs.d/lisp/pdffontetc/")
(require 'pdffontetc)The easiest if you’re using Emacs 30 or above is the built-in vc-use-package.
Included in Emacs 30+. Probably the easiest alternative method:
(use-package pdffontetc
:vc (pdffontetc :url "https://github.com/emacsomancer/pdffontetc"
:branch "main")
:ensure t)If you use an alternative/supplement package manager already, you probably know what you’re doing. But some tips for different options:
The non-built-in version of vc-use-package uses slightly different syntax:
(use-package pdffontetc
:vc (:fetcher github :repo "emacsomancer/pdffontetc")
:ensure t)With elpaca:
(use-package pdffontetc
:ensure (:host github :repo "emacsomancer/pdffontetc"))With straight:
(use-package pdffontetc
:straight (pdffontetc :type git :host github :repo "emacsomancer/pdffontetc")
:ensure t)With quelpa:
(use-package pdffontetc
:quelpa (pdffontetc :fetcher github :repo "emacsomancer/pdffontetc")
:ensure t)The pdffonts help key (available in emacs after the package is loaded via pdffontetc-pdffonts-man-help):
name: the font name, exactly as given in the PDF file (potentially including a subset prefix)type: the font type – see below for detailsemb: “yes” if the font is embedded in the PDF filesub: “yes” if the font is a subsetuni: “yes” if there is an explicitToUnicodemap in the PDF file (the absence of aToUnicodemap doesn’t necessarily mean that the text can’t be converted to Unicode)object ID: the font dictionary object ID (number and generation; given here in formatNumber.Generation)
Type 1Type 1C[= Compact Font Format (CFF)]Type 3TrueTypeCID Type 0[= 16-bit font with no specified type]CID Type 0C[= 16-bit PostScript CFF font]CID TrueType[= 16-bit TrueType font]
[ adapted from man pdffonts ]
(for more details on PDF font types, see Wikpedia on “PostScript fonts”)
- PDF Tools (obviously): viewing PDFs in Emacs
- pdf-meta-edit: editing PDF metadata, labels, & bookmarks in Emacs
- emacs-reader: aims to support a full range of “document” formats, including not only PDF, but also esp. EPUB, MOBI, FB2, XPS/OpenXPS, CBZ (with lower priority support for Liberoffice-type Open Document Formats - ODT, ODS, ODP, ODG); focussing on taking advantage of dynamic (native) modules of Emacs, and ultimately upcoming patches to Emacs’ canvas rendering and drawing on PALE (a Picture and Animation Library for Emacs, which attempts to implement real-time graphics in Emacs [see the Doom on Emacs demo])
0 For the creator field, see the nascent Emacs System Information and Environs package, under the “encoding system details” section.
1 E.g, for looking if a document is at least formally PDF/UA-1 compliant, check:
Part: Should be1(indicating PDF/UA-1).PDFUAVersion: Often shows the specific version of the standard.AMD: (Amendment) may show any revisions to the standard.Trapped: Must be False for PDF/UA-1 compliance.Title: A document title is mandatory for PDF/UA-1; if this is empty, it fails compliance.
(The fact that exiftool -Part returned 1 confirms a file has the PDF/UA-1 identifier embedded only means the file claims to be compliant. A structural validator like PAC 2024 is still needed to ensure the tags and reading order are actually correct, and even that doesn’t guarantee the document is fully implements everything that is suggested for accessibility.)


