The Portable Document Format (PDF) is a fixed-layout file format developed by Adobe in 1992. It encapsulates a complete description of a fixed-layout flat document, including the text, fonts, vector graphics, raster images, and other information needed to display it.
The PDF Document Structure
A PDF file consists of four primary sections:
- Header: Defines the PDF version (e.g.,
%PDF-1.7). - Body: Contains a sequence of indirect objects representing the document contents (fonts, pages, images).
- Cross-Reference Table (xref): An index mapping object numbers to byte offsets within the file, allowing random access to objects without parsing the entire file.
- Trailer: Contains the location of the xref table and the root object (Catalog).
Typography and Subsetting
A critical engineering consideration in PDF generation is font embedding. To guarantee fidelity, fonts must be embedded. However, embedding entire font files drastically increases payload size. Subsetting is the protocol of including only the glyphs explicitly utilized in the document, resulting in a custom, localized font dictionary.