dump_annots

Dump annotation info

Usage

pdftl <input> dump_annots [<selector>...] [output <output>]

Details

Extracts all annotations from the PDF and dumps them in a structured JSON format.

Unlike dump_data_annots, this operation provides a raw, comprehensive view of the annotation dictionaries, including all properties (e.g., Rect, Contents, Colors, Flags).

The output is a JSON list where each entry represents an annotation, grouped by page. This is useful for debugging, analysis, or processing annotation data in other tools that consume JSON.

Filtering

Annotations can be filtered using the same selector syntax as modify_annots. Selectors are optional; without them, all annotations are dumped.

The syntax is selector or selector(Key=Value, ...), where:

  • selector is a page range (e.g., 1-5, odd, see [[page_specs]]) and/or an annotation type (e.g., /Link, /Highlight).

  • Key=Value pairs filter annotations by property value.

Value Syntax

  • PDF Names: /Name

  • PDF Strings: (My String)

  • PDF Arrays: [0 0 1]

  • PDF Booleans: true / false

  • Numbers: 1.5, 10

  • Plain strings are treated as PDF Strings: Value is interpreted as (Value)

Examples

Show all annotation data for a file:

pdftl in.pdf dump_annots

Show only Link annotations on pages 1-5:

pdftl in.pdf dump_annots 1-5/Link

Show only Highlight annotations on odd pages:

pdftl in.pdf dump_annots odd/Highlight

Show only Link annotations with a zero border:

pdftl in.pdf dump_annots "/Link(Border=[0 0 0])"

Tags: in_place, annotations, info

Source: pdftl.operations.annots_filters

Read online: https://pdftl.readthedocs.io/en/stable/operations/dump_annots.html

Type: Operation