PDF, short for Portable Document Format, is a file format that shows a document the same way on any screen or printer. A PDF file carries the text, fonts, pictures, and exact page layout inside it. Readers do not need the program that made the document.[1][2]
Adobe released PDF in 1993 and built it on PostScript, its language for describing printed pages.[3][2] In 2008 PDF became an open international standard, ISO 32000, and it is now one of the most widely used formats for sharing documents.[1][4]
What a PDF holds
A PDF describes finished pages. The program that writes the file makes all the layout and formatting decisions, so a viewer only has to draw what the file says.[2]
- Fixed appearance. Each page's look is fully set inside the file. A reader does not reflow the text or pick its own fonts.[2]
- Device independence. Text and graphics are described in a way that does not depend on any one device or resolution. This lets the same file print on a cheap printer or show on a high-resolution screen.[2][1]
- Self-contained files. Fonts can be embedded in the file, and faithful display needs them to be.[1]
- Interactive extras. A PDF can hold hypertext links, bookmarks, notes, forms, file attachments, sound, and video.[1][2]
- Compression. Most of the content in a typical PDF is compressed to keep files small.[1]
History
The Camelot project
In 1991, Adobe co-founder John Warnock announced a project code-named Camelot.[3] His paper said that programs could print to many printers, but there was no universal way to send and view that printed material electronically. Fax machines offered one way, but they were low quality, needed a lot of bandwidth, and were tied to the device.[5]
Warnock proposed a simplified form of PostScript, which he called Interchange PostScript (IPS). An IPS file would carry only the characters of each font that the document used, so it would not depend on the fonts installed at the receiving end.[5] The format also had to be device independent, so files could print in color or black and white and be magnified on screen.[5]
Adobe's versions
Adobe published the first PDF specification in June 1993, at the same time as the first Acrobat products.[2][4] Adobe kept extending the format and made each specification available openly and at no charge.[1]
| Version | Year | Examples of what it added |
|---|---|---|
| 1.0 | 1993 | First published version[4] |
| 1.1 | 1996 | The BX and EX operators, which let older readers skip operators they do not know[6] |
| 1.2 | 1996 | Flate (Deflate) compression[1] |
| 1.3 | 2000 | Progressive JPEG images[1] |
| 1.4 | 2001 | Tagged PDF; XMP metadata, a standard format for describing the document; JBIG2 compression for black-and-white images[1] |
| 1.5 | 2003 | JPEG 2000 images; cross-reference streams; the Crypt filter, which names the encryption used on a single stream[1][6] |
| 1.6 | 2004 | A page-by-page setting for the size of the drawing unit[7] |
| 1.7 | 2006 | Became the basis of ISO 32000-1[1] |
| 2.0 | 2017 | Published by ISO as ISO 32000-2[4] |
Years are those given by the PDF Association.[4]
An ISO standard
Adobe handed PDF 1.7 to the International Organization for Standardization (ISO), which published it as ISO 32000-1 in July 2008.[4] With that standard, Adobe issued a Public Patent License. It gives everyone a royalty-free right to make, use, and sell conforming software under the Adobe patents that any conforming software would need.[1]
Since 2008, the main PDF specification has been maintained by working group WG 8 of ISO committee TC 171 SC 2.[1] PDF 2.0 appeared as ISO 32000-2 in July 2017, and a revised second edition followed in December 2020.[4] In April 2023, the PDF Association began offering the PDF 2.0 standard as a free download.[1]
Relation to PostScript
PDF uses the same imaging model as PostScript, Adobe's page description language for printers.[2] An imaging model is the set of rules for describing text, shapes, and images on a page. A document can be converted between PDF and PostScript, and both forms give the same printed output.[2]
PostScript is a full programming language. PDF has no general programming framework and is instead a structured file format built for fast interactive viewing.[1][2]
PDF also has objects that are not part of the printed page, such as annotations and hypertext links.[2]
How a PDF file is built
Objects
A PDF file is made of objects, basic pieces of data much like the values in JSON.[8] ISO 32000-1 defines eight basic object types. Integers and reals count as one type, numbers, but the table below lists them on separate rows.[9]
| Type | Example | What it holds |
|---|---|---|
| Boolean | true |
True or false |
| Number (integer) | -456 |
A whole number |
| Number (real) | 1.23 |
A number with a decimal point (no exponent form such as 1.23e4) |
| String | (Hello) or <48656C6C6F> |
Text or bytes, in brackets or as hexadecimal |
| Name | /Type |
A label that starts with a slash |
| Array | [123 (foo) /bar] |
An ordered list of objects |
| Dictionary | << /Key (value) >> |
Pairs of a name key and a value |
| Stream | dictionary, then bytes between stream and endstream |
Large data such as images and page content |
| Null | null |
No value |
The examples follow Endignoux's guide to PDF syntax.[8][9]
An indirect object puts a label on an object. The label is an object number and a generation number, followed by the keyword obj, with endobj after the object, as in 4 0 obj ... endobj.[9] Other objects point to it with a reference such as 4 0 R, which lets many pages share one font.[9][8]
File layout
A basic PDF file has four parts, in this order.[9]
- Header. The first line is
%PDF-followed by the version, such as%PDF-1.7. Version numbers run from 1.0 to 1.7, plus 2.0.[1] If the file holds binary data, the next line is a comment with at least four bytes of value 128 or more, which tells file-transfer tools to treat the file as binary.[6] - Body. The indirect objects that make up the document.[8]
- Cross-reference table. One line for each indirect object, giving its byte offset, which is its position counted in bytes from the start of the file. A reader can jump straight to any object without reading the whole file.[6]
- Trailer. A dictionary with entries such as
/Size(one more than the highest object number) and/Root(the document catalog).[6][1] After it come the keywordstartxref, the byte offset of the last cross-reference section, and the end-of-file marker%%EOF.[6]
Because these pointers sit at the end, readers should read a PDF starting from its end.[6]
The media type application/pdf was registered in RFC 3778 in 2004 and updated in RFC 8118 in 2017.[1][4]
startxref offset to the cross-reference table, and uses the /Root 1 0 R entry to find the catalog object.From catalog to page
The trailer's /Root entry points to the document catalog, the main dictionary that leads directly or indirectly to every other object in the document.[1][9] The catalog points to a page tree whose /Kids array lists the pages. Each page object names its content stream and its resources, such as fonts.[8]
The objects below are adapted from a minimal "Hello world" file.[8]
1 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj
2 0 obj
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
endobj
3 0 obj
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 700 200]
/Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>
endobj
4 0 obj
<< /Length 35 >>
stream
BT /F1 100 Tf (Hello world !) Tj ET
endstream
endobj
5 0 obj
<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
endobj
Content streams
A content stream is a stream whose data is a list of instructions for painting a page.[9] Each instruction gives its operands first and its operator last. An operand is a value, and an operator is the command that uses those values, as in /F1 100 Tf.[9]
The example stream above uses these operators.
BTbegins a text object, andETends it.[10]/F1 100 Tfsets the text font toF1at size 100.[10](Hello world !) Tjshows the string.[11]
By default, one unit of page space is 1/72 inch. Starting with PDF 1.6, a page can set a different unit size with its UserUnit entry.[7]
Streams and compression
Stream data is often compressed. The stream's dictionary names the filters a reader must apply to decode the data, and several filters can be chained.[1]
| Filter | Method | Typical use |
|---|---|---|
| FlateDecode | zlib/Deflate (PDF 1.2 and later) | Most common choice for text content |
| LZWDecode | Lempel-Ziv-Welch | General lossless compression |
| DCTDecode | JPEG | Photographs |
| JPXDecode | JPEG 2000 (PDF 1.5 and later) | Images |
| JBIG2Decode | JBIG2 (PDF 1.4 and later) | Black-and-white images |
| CCITTFaxDecode | Fax Group 3 or Group 4 | Black-and-white images |
| RunLengthDecode | Run-length encoding | Simple repeated bytes |
| ASCIIHexDecode, ASCII85Decode | Binary written as text | Older text-only channels |
All rows come from the Library of Congress format description.[1] See data compression for the general methods.
Incremental updates
A PDF can be changed by adding to the end of the file instead of rewriting it.[1][8] Each update appends these parts.
- New or changed objects.[8]
- A new cross-reference section that lists only the objects added, modified, or deleted.[6]
- A new trailer whose
/Preventry gives the byte offset of the previous cross-reference section.[6] - A new
startxrefline and%%EOFmarker.[8]
The header at the start is not rewritten in an update. So from PDF 1.4 on, an update can raise the document's version through a Version entry in the catalog.[1][6]
/Prev entry gives the byte offset of the previous cross-reference section.Object streams and linearization
PDF 1.5 added two ways to shrink files. Object streams pack many objects into one compressed stream. Cross-reference streams store the cross-reference data in compressed form.[8][6]
A linearized PDF, also called Fast Web View, is laid out so a viewer can show the first page before the whole file has downloaded.[1][8][12] It places a linearization dictionary near the start, together with the objects for the first page and hint tables that locate the rest.[8] An incremental update ends linearization, because the file's length no longer matches the length recorded in that dictionary.[12]
Features beyond the page
PDF supports many features that only make sense on a computer.[2][9][1]
- Navigation. Hypertext links and bookmarks.[1]
- Annotations. Text notes, markup, file attachments, sounds, and movies.[2]
- Forms. Fields that a user can fill in.[2][9]
- Digital signatures.[9]
- Security. Encryption and password protection.[1]
- Metadata. From PDF 1.4, metadata streams in the Extensible Metadata Platform (XMP) format, for the whole document or single objects.[1]
- 3D and maps. 3D artwork, and in later versions geospatial data for maps.[9][1]
- Portfolios. Collections of PDFs or other files carried inside one PDF wrapper.[1]
Tagged PDF and accessibility
A content stream only lists what to paint on the page.[2] Tagged PDF, added in PDF 1.4, adds a separate structure tree that records the document's logical parts. Pointers link each part of the tree to the content it covers.[1]
Each tag marks an element, such as a paragraph (P), a level-three heading (H3), a list item (LI), an image (Figure), or a table cell (TD). The order of the tags sets the reading order.[1] Tags make these tasks reliable.[1]
- Copying text and graphics into other programs.
- Reflowing text to fit a page of a different size.
- Searching, indexing, and spell-checking.
- Converting to formats such as HTML, XML, and RTF.
- Reading the document with assistive technology such as screen readers.
Many PDFs have no tags. Methods such as "printing to PDF" do not create them.[1]
PDF/UA (ISO 14289) is the ISO standard for accessible PDF, and its first edition appeared in 2012.[1][4] See computer accessibility for the wider field.
Standard subsets
ISO also publishes subsets of PDF. Each subset is a restricted form of PDF meant for one kind of work.[1][12]
| Subset | Standard | Purpose | First ISO edition |
|---|---|---|---|
| PDF/X | ISO 15930 | Exchanging print-ready graphics files | 2001 |
| PDF/A | ISO 19005 | Long-term preservation | 2005 |
| PDF/E | ISO 24517 | Engineering documents | 2008 |
| PDF/VT | ISO 16612-2 | Exchanging variable data for printing | 2010 |
| PDF/UA | ISO 14289 | Accessibility | 2012 |
Standards and dates come from the Library of Congress and the PDF Association.[1][4] PDF/A, PDF/X, and PDF/E all require embedded fonts.[1]
PDF/A
PDF/A aims to keep a document's look over time, whatever tools are later used to store or show it.[12]
PDF/A-1 was based on PDF 1.4, and PDF/A-2 and PDF/A-3 were based on PDF 1.7.[12] PDF/A-4, published in November 2020, is based on PDF 2.0.[12][4]
PDF/A-1, PDF/A-2, and PDF/A-3 have these rules.[12]
- No audio, video, or 3D artwork.
- No JavaScript and no launching of programs.
- All fonts embedded, with licenses that allow embedding.
- Colors specified in a device-independent way.
- No encryption.
- Standard metadata required.
PDF/A-4 relaxes the JavaScript rule. Scripts may be kept in an embedded file, but a conforming viewer must not run them without an explicit user action.[12]
Limitations
Extracting text
Getting plain text out of a PDF can fail. A glyph is the drawn shape of a character, and a PDF picks each character by the number of its glyph inside an embedded font, not by its Unicode value as a word-processing file does.[13]
Some programs drop the mapping from glyphs back to Unicode to save space, which blocks extraction. Others write wrong mappings, so the extracted text comes out as garbage.[13]
Finding the version
The header may not give a file's true version. From PDF 1.4, the Version entry in the catalog can override it. Tools that only check the first bytes of a file can then misidentify it.[1]
Meeting the standards
Files that claim to follow a subset do not always pass a check. In a 2018 study of theses at the University of Oxford, 50 of 201 PDF/A files made by Acrobat DC failed validation with the open-source veraPDF tool.[12]
References
- PDF (Portable Document Format) Family, Library of Congress, Sustainability of Digital Formats.
- PDF Reference, sixth edition, version 1.7, Adobe Systems, 2006.
- Promoting ISO standards for PDF technology, PDF Association, 2019.
- Milestones in the History of PDF, PDF Association, 2025.
- The Camelot Project, John Warnock (hosted by the PDF Association), 1991.
- Errata for ISO 32000-2:2020, clause 7: Syntax, PDF Association.
- PdfPage Class, GemBox.Pdf documentation.
- Introduction to PDF syntax, Guillaume Endignoux, 2016.
- Document management, Portable document format, Part 1: PDF 1.7 (ISO 32000-1), Adobe Systems, 2008.
- PDF11: Providing links and link text using the Link annotation, W3C Web Accessibility Initiative.
- Uses of class OperatorProcessor, Apache PDFBox documentation.
- PDF/A Family, PDF for Long-term Preservation, Library of Congress, Sustainability of Digital Formats.
- Why is the extraction of text from a PDF document such a hassle, PDF Tools AG, 2014.
