Introduction
PDF was created by Adobe in 1993 to show a document exactly as intended on any computer or printer. It became an open standard as ISO 32000: PDF 1.7 in 2008 and PDF 2.0 in 2017. A PDF holds fixed pages of text, vector graphics and images, with the fonts embedded, and can also carry links, forms, annotations, attachments and digital signatures.
Structure
A PDF file starts with a header line such as %PDF-1.7, usually followed
by a comment of a few bytes above 127 so that transfer programs treat the file as
binary. The body is a series of numbered objects, each written as
12 0 obj … endobj: dictionaries, arrays, numbers, strings, names and
streams of compressed data. Pages, fonts and images are all objects that refer to
each other by number.
The cross-reference table, starting with xref, gives the byte offset of
every object so a reader can jump straight to it. The trailer names the root object,
the document catalog, and the file ends with startxref, the offset of the
table, and %%EOF. An edited PDF can append a new body, table and trailer
rather than rewrite the file. Since PDF 1.5 the table and many objects may themselves
be held in compressed streams.
0Header%PDF-1.7and a binary commenta line or two…Body numbered objects: catalog, pages, fonts, images, content streamsvaries…Cross-reference table the byte offset of every object20 bytes per object…Trailer root object, size,startxref,%%EOFa few lines
Links
Software
- Adobe Acrobat Reader (Windows, macOS, mobile)
- PDF.js, the viewer built into Firefox (web browsers)
- SumatraPDF (Windows)
- Okular (Linux, Windows)
- LibreOffice Draw (Windows, macOS, Linux), for editing
- Ghostscript (Windows, macOS, Linux)
- qpdf (command line tool and library)
Developers
- PDF.js, JavaScript library that parses and renders PDF
- pypdf, Python library that reads, splits, merges and writes PDF
- Apache PDFBox, Java library for reading and creating PDF
- qpdf, C++ library for inspecting and rewriting PDF structure
- MuPDF, C library and viewer for rendering PDF
Reference
- ISO 32000 (PDF), PDF Association, with access to the PDF 2.0 standard