modify_annots
Modify properties of existing annotations
Usage
pdftl
<input>modify_annots<spec(K=V...)>...output<output>
Details
Modifies properties of existing annotations (e.g., links, highlights) on specified pages.
This operation allows for targeted, surgical changes to annotation dictionaries, such as changing a link’s border or a highlight’s color.
The syntax is selector(Key=Value, ...), where:
selectoris a page range (e.g.,1-5,odd, see [[page_specs]]) and/or an annotation type (e.g.,/Link,/Highlight).Key=Valuepairs define the PDF dictionary keys to set and their new values.
Value Syntax
PDF Names:
/NamePDF Strings:
(My String)PDF Arrays:
[0 0 1]PDF Booleans:
true/falseNull (to delete a key):
nullNumbers:
1.5,10Plain strings are treated as PDF Strings:
Valueis interpreted as(Value)
Examples
Remove the visible border from all links in the document.
pdftl in.pdf modify_annots "1-end/Link(Border=[0 0 0])" output out.pdf
Change the color of all highlights on odd pages to red.
pdftl in.pdf modify_annots "odd/Highlight(C=[1 0 0])" output out.pdf
Set the ‘Title’ (author) of all text notes to ‘New Author’.
pdftl in.pdf modify_annots "/Text(T='(New Author)')" output out.pdf
Delete the custom key ‘/MyKey’ from all annotations on pages 1-5.
pdftl in.pdf modify_annots "1-5(MyKey=null)" output out.pdf
Tags: in_place, annotations
Source: pdftl.operations.modify_annots
Read online: https://pdftl.readthedocs.io/en/stable/operations/modify_annots.html
Type: Operation