delete_annots

Delete annotation info

Usage

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

Details

The delete_annots operation deletes annotations in a PDF file.

Without selectors, all annotations are removed from all pages.

Filtering

Annotations can be filtered using the same selector syntax as dump_annots and modify_annots. Selectors are optional.

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

Delete all annotations from in.pdf

pdftl in.pdf delete_annots output out.pdf

Delete only Link annotations on pages 1-5

pdftl in.pdf delete_annots 1-5/Link output out.pdf

Delete only Highlight annotations on odd pages

pdftl in.pdf delete_annots odd/Highlight output out.pdf

Delete only Link annotations with a zero border

pdftl in.pdf delete_annots "/Link(Border=[0 0 0])" output out.pdf

Tags: in_place, annotations, delete

Source: pdftl.operations.annots_filters

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

Type: Operation