Beyond its pages, a PDF can hold things a viewer lets people use: links, comments and
other annotations, actions, fill-in forms, digital signatures, attached files, sound,
video and 3D. They live in objects outside the content streams, mostly in each page’s
Annots array and in the catalog. “Since” is the version that added an item;
“2.0 deprecated” means PDF 2.0 says it should no longer be written.
Annotations
An annotation is a dictionary tied to a rectangle on a page, listed in the page’s
Annots. Every annotation can have these keys:
| Key | Since | Meaning |
|---|---|---|
Type | 1.0 | Annot |
Subtype | 1.0 | Required. The annotation type |
Rect | 1.0 | Required. Where it is on the page, in default user space |
Contents | 1.0 | Its text, or a description of it for accessibility |
P | 1.3 | The page it is on |
NM | 1.4 | A name unique on the page |
M | 1.1 | When it was last changed |
F | 1.1 | The flags |
AP | 1.2 | The appearance streams |
AS | 1.2 | The current appearance state, for check boxes and the like |
Border | 1.0 | Corner radii and width, default [0 0 1]; later replaced by BS |
C | 1.1 | A colour: 0, 1, 3 or 4 numbers |
StructParent | 1.3 | Its key in the structure parent tree |
OC | 1.5 | The optional content it belongs to |
AF, ca, BM, Lang | 2.0 | Associated files, fill opacity, blend mode and language |
Markup annotations, the comment types, also have T (author, 1.1),
Popup (1.3), CA (opacity, 1.4), RC (rich text,
1.5), CreationDate, IRT (the annotation it replies to) and
Subj (1.5), RT and IT (reply type and intent,
1.6), and ExData (1.7).
Annotation types
Subtype | Since | Markup | What it is |
|---|---|---|---|
Text | 1.0 | yes | A sticky note, shown as an icon |
Link | 1.0 | no | A link: Dest or A, an action |
FreeText | 1.3 | yes | Text written straight on the page |
Line | 1.3 | yes | A line, with optional arrow heads and caption |
Square, Circle | 1.3 | yes | A rectangle or ellipse |
Polygon, PolyLine | 1.5 | yes | A closed or open shape of straight lines |
Highlight, Underline, StrikeOut | 1.3 | yes | Text markup, over QuadPoints |
Squiggly | 1.4 | yes | A wavy underline |
Caret | 1.5 | yes | A mark for inserted text |
Stamp | 1.3 | yes | A rubber stamp, such as “Approved” |
Ink | 1.3 | yes | Freehand paths |
Popup | 1.3 | no | The pop-up window of another annotation |
FileAttachment | 1.3 | yes | A file attached at a point on the page |
Sound | 1.2 | yes | A sound. 2.0 deprecated |
Movie | 1.2 | no | A movie. 2.0 deprecated |
Widget | 1.2 | no | A form field’s visible part |
Screen | 1.5 | no | An area where media plays |
PrinterMark | 1.4 | no | A printer’s mark, such as a crop mark or colour bar |
TrapNet | 1.3 | no | Trapping for printing. 2.0 deprecated |
Watermark | 1.6 | no | A watermark printed at a fixed size and place |
3D | 1.6 | no | A 3D model, U3D and later PRC |
Redact | 1.7 | yes | Content marked for removal |
Projection | 2.0 | yes | A note on a 3D or geospatial view (earlier as Adobe’s extension level 3) |
RichMedia | 2.0 | no | Rich media such as video and SWF (earlier as Adobe’s extension level 3) |
A Redact annotation only marks content. Redaction is done when a program
applies it, removes the content from the content streams and replaces the annotation
with its overlay; a file that keeps the annotation still holds the content.
Appearance streams
How an annotation looks is a form XObject, its appearance stream, in the
AP dictionary: N (normal, required when there is
AP), R (rollover, mouse over it) and D (down,
pressed). Each is a stream or, for fields with states such as a check box, a
dictionary of streams by state name, with AS naming the current one, for
example /Yes or /Off. The form’s BBox is mapped
onto the annotation’s Rect. From PDF 2.0 an appearance stream is required
for every annotation with a rectangle that is not empty, except Popup,
Link and a few others; before that a viewer drew many types itself from
their keys.
Annotation flags
| Bit | Name | Since | Meaning |
|---|---|---|---|
| 1 | Invisible | 1.1 | Do not show an annotation of an unknown type |
| 2 | Hidden | 1.2 | Do not show or print it |
| 3 | 1.2 | Print it | |
| 4 | NoZoom | 1.3 | Do not scale it with the page |
| 5 | NoRotate | 1.3 | Do not rotate it with the page |
| 6 | NoView | 1.3 | Do not show it on screen, but allow printing |
| 7 | ReadOnly | 1.3 | Do not let the user interact with it |
| 8 | Locked | 1.4 | Do not let the user move, resize or delete it |
| 9 | ToggleNoView | 1.5 | Reverse NoView on some events, such as mouse over |
| 10 | LockedContents | 1.7 | Do not let the user change its contents |
Actions
An action is a dictionary with Type Action, S, its type,
and Next, an action or array of actions to run after it. Actions are run
by links, bookmarks, OpenAction, and the additional actions
(AA) of the document, pages, annotations and fields, triggered by events
such as opening a page, entering a field or changing its value.
S | Since | What it does |
|---|---|---|
GoTo | 1.1 | Go to a destination in this document |
GoToR | 1.1 | Go to a destination in another PDF file |
GoToE | 1.6 | Go to a destination in an embedded PDF |
GoToDp | 2.0 | Go to a document part |
Launch | 1.1 | Open or run a file |
Thread | 1.1 | Start reading an article thread |
URI | 1.1 | Open a URI, such as a web page |
Sound | 1.2 | Play a sound. 2.0 deprecated |
Movie | 1.2 | Play a movie. 2.0 deprecated |
Hide | 1.2 | Show or hide annotations |
Named | 1.2 | A viewer command: NextPage, PrevPage, FirstPage, LastPage |
SubmitForm | 1.2 | Send the form’s data to a URL, as FDF, XFDF, HTML form data or PDF |
ResetForm | 1.2 | Set fields back to their defaults |
ImportData | 1.2 | Fill fields from an FDF file |
JavaScript | 1.3 | Run a script |
SetOCGState | 1.5 | Turn optional content groups on and off |
Rendition | 1.5 | Play, stop or pause media in a Screen annotation |
Trans | 1.5 | Update the display with a transition |
GoTo3DView | 1.6 | Set the view of a 3D annotation |
RichMediaExecute | 2.0 | Send a command to a RichMedia annotation (earlier as Adobe’s extension level 3) |
SetState and NOP are obsolete early actions that should not
be written.
Viewers usually ask before Launch and may refuse it.
JavaScript
A JavaScript action, from PDF 1.3, holds its script in JS, a
text string or a stream. Scripts run from document-level entries in the name
dictionary’s JavaScript tree when the document opens, from
OpenAction, and from field and page events. They use Adobe’s JavaScript
for Acrobat API, which is described by Adobe, not by ISO 32000. Viewers other than
Acrobat run few or none of them, and many security tools flag them. PDF/A forbids
JavaScript.
Interactive forms (AcroForm)
The catalog’s AcroForm dictionary, from PDF 1.2, holds the form:
| Key | Since | Meaning |
|---|---|---|
Fields | 1.2 | Required. The top-level fields |
NeedAppearances | 1.2 | Ask the viewer to build field appearances itself. 2.0 deprecated |
SigFlags | 1.3 | Bit 1 SignaturesExist, bit 2 AppendOnly: save only by incremental update |
CO | 1.3 | The order in which to calculate fields |
DR | 1.2 | Default resources, such as the fonts for field text |
DA | 1.2 | Default appearance: a content stream fragment such as (/Helv 0 Tf 0 g) |
Q | 1.2 | Default alignment: 0 left, 1 centre, 2 right |
XFA | 1.5 | An XML Forms Architecture form, as a stream or an array of packets. 2.0 deprecated |
An XFA form describes the form in XML, which Acrobat builds and lays out itself. A
file can be an AcroForm with XFA added, or, with NeedsRendering, a
“dynamic” XFA form whose pages are only a placeholder. Most viewers other than Acrobat
ignore XFA.
Fields
Fields form a tree, through Kids and Parent. A field’s full
name joins the partial names T of it and its ancestors with dots:
address.street. A field with one visible part is often merged with its
widget annotation into one dictionary.
| Key | Since | Meaning |
|---|---|---|
FT | 1.2 | The type: Btn button, Tx text, Ch choice, Sig signature (1.3). Inheritable |
T | 1.2 | The partial name |
TU, TM | 1.3 | A name to show the user, and one to use when exporting |
Ff | 1.2 | Field flags, below |
V, DV | 1.2 | The value and the default value |
AA | 1.3 | Actions on keystroke, format, validate and calculate |
DA, Q | 1.2 | Default appearance and alignment of a text field |
DS, RV | 1.5 | A default style and a rich-text value |
MaxLen | 1.2 | Text fields: the longest value |
Opt, TI, I | 1.2, 1.2, 1.4 | Choice fields: the options, the first shown, and the selected indices |
Lock, SV | 1.5 | Signature fields: which fields signing locks, and seed values for the signature |
| Bit | Fields | Name | Since |
|---|---|---|---|
| 1 | all | ReadOnly | 1.2 |
| 2 | all | Required | 1.2 |
| 3 | all | NoExport | 1.2 |
| 13 | text | Multiline | 1.2 |
| 14 | text | Password | 1.2 |
| 15 | button | NoToggleToOff (radio) | 1.2 |
| 16 | button | Radio | 1.2 |
| 17 | button | Pushbutton | 1.2 |
| 18 | choice | Combo | 1.2 |
| 19 | choice | Edit | 1.2 |
| 20 | choice | Sort | 1.2 |
| 21 | text | FileSelect | 1.4 |
| 22 | choice | MultiSelect | 1.4 |
| 23 | text, choice | DoNotSpellCheck | 1.4 |
| 24 | text | DoNotScroll | 1.4 |
| 25 | text | Comb | 1.5 |
| 26 | text | RichText | 1.5 |
| 26 | button | RadiosInUnison | 1.5 |
| 27 | choice | CommitOnSelChange | 1.5 |
A button with neither Radio nor Pushbutton set is a check box.
Digital signatures
A signature, from PDF 1.3, is a signature field (FT Sig) whose value
V is a signature dictionary. The signature covers the whole file as it was
when signed, except the signature’s own bytes.
| Key | Since | Meaning |
|---|---|---|
Type | 1.3 | Sig, or DocTimeStamp (2.0) |
Filter | 1.3 | Required. The preferred handler, such as Adobe.PPKLite |
SubFilter | 1.3 | The signature’s encoding, below |
Contents | 1.3 | Required. The signature itself, as a hexadecimal string, usually a DER-encoded PKCS#7 or CMS object padded with zeros |
Cert | 1.3 | For adbe.x509.rsa_sha1: the certificate chain |
ByteRange | 1.3 | Pairs of offset and length of the bytes signed, usually [0 a b c]: everything but the Contents string |
Reference | 1.5 | Signature references, such as DocMDP |
Changes | 1.3 | Counts of pages, fields and other changes |
Name, M, Location, Reason, ContactInfo | 1.3 | Who signed, when, where, why, and how to reach them; information only, not checked |
V | 1.5 | The version of the signature dictionary format |
Prop_Build, Prop_AuthTime, Prop_AuthType | 1.5 | About the software that signed, and how the signer was authenticated |
SubFilter | Since | Contents |
|---|---|---|
adbe.x509.rsa_sha1 | 1.3 | A raw RSA signature of a SHA-1 digest, with the certificates in Cert |
adbe.pkcs7.detached | 1.3 | A detached PKCS#7 (CMS) signature of the byte ranges; the usual form |
adbe.pkcs7.sha1 | 1.4 | A PKCS#7 signature of the SHA-1 digest of the byte ranges. 2.0 deprecated |
ETSI.CAdES.detached | 2.0 | A CAdES signature, as in PAdES (ETSI EN 319 142) |
ETSI.RFC3161 | 2.0 | A document timestamp: an RFC 3161 time-stamp token, in a DocTimeStamp dictionary |
Each new signature is added by an incremental update, so earlier signatures still
cover their own versions of the file. A reader checks a signature by hashing the bytes
in ByteRange and verifying Contents against the hash; it should
also check that ByteRange covers the whole file apart from
Contents, and report what later updates changed.
- DocMDP (1.5): a certification signature, referred to from the
catalog’s
Perms, whose transform parametersPsay what may change afterwards: 1 nothing, 2 filling in forms and signing (the default), 3 also annotations. - FieldMDP (1.5): a signature that locks certain fields.
- Document security store (2.0, earlier an ETSI extension to 1.7):
the catalog’s
DSSholdsCerts,OCSPsandCRLs, streams of certificates and revocation data, andVRI, which ties them to each signature, so that a signature can be checked long after the certificates have expired. With document timestamps, this is what PAdES long-term validation uses.
Embedded files and file specifications
A file specification names a file. It may be a string, or a dictionary:
| Key | Since | Meaning |
|---|---|---|
Type | 1.3 | Filespec |
FS | 1.1 | The file system, such as URL |
F | 1.1 | The file name, in the PDF form with slashes |
UF | 1.7 | The file name as a Unicode text string |
DOS, Mac, Unix | 1.1 | Names for one system. 2.0 deprecated |
ID | 1.1 | The file’s ID, if it is a PDF |
V | 1.2 | Volatile: do not cache it |
EF | 1.3 | The embedded file streams, by name (F, UF) |
RF | 1.3 | Related files |
Desc | 1.6 | A description |
CI | 1.7 | The values for a collection |
Thumb | 2.0 | A thumbnail image |
AFRelationship | 2.0 | How an associated file relates to the PDF: Source, Data, Alternative, Supplement, EncryptedPayload, FormData, Schema or Unspecified |
EP | 2.0 | An encrypted payload document |
The embedded file itself is a stream of Type EmbeddedFile, from PDF 1.3,
with Subtype, its MIME type written as a name
(/application#2Fxml), and Params: Size,
CreationDate, ModDate and CheckSum, an MD5 of the
data. Files are attached to the document through the name dictionary’s
EmbeddedFiles tree, to a page through FileAttachment
annotations, and, from PDF 2.0 (and PDF/A-3 before it), to the document, a page or any
object through AF, associated files. An invoice in the Factur-X or
ZUGFeRD form is a PDF/A-3 with its XML data attached this way.
PDF 2.0 also defines an unencrypted wrapper: a PDF whose only real content is an
encrypted PDF embedded with AFRelationship EncryptedPayload, so that a
reader that cannot decrypt it can still show a cover page.
Multimedia
- Sound and Movie annotations and actions (1.2) – the first media support, deprecated in PDF 2.0.
- Renditions (1.5) – a
Screenannotation andRenditionactions play media clips, chosen by criteria such as the bit rate or the language, with players named by MIME type. - 3D (1.6) – a
3Dannotation holds a 3D stream of U3D (ECMA-363), or in later files PRC (ISO 14739-1), with views, lighting and cross-sections. - Rich media (2.0, earlier as Adobe’s extension level 3) – a
RichMediaannotation holds video, sound or 3D content and the settings for playing it. In Acrobat it played SWF through Flash, which has gone.