How to Define Annotations

Table of Content

Workspace

Preferences

General

Display

Panels

Shortcuts

App View

Accessibility

Page Map

Table Tool

Template

PDFix Actions

Action Manager

Selection Tools

Validation

Accessibility

Tags

Annotations

Content

Bookmarks

Conversion

Destinations

Browser

Template

License

Define the Annotations to which the specific action is applied. Combo box Annotations gives you multiple options how to do that.

SET CONTENTS ON THE DOCUMENT ANNOTATION DIALOG

In the combo box you can simply check annotations types you want to process.

dialog of annotations types

For each action, there are predefined subsets of annotations defined by regex or template. For example, Ignore Hidden and Invisible processes each annotation that is neither hidden nor invisible.

screenshot of the dialog showing predefined annotations sets

Annotation types can be easily defined using a regular expression. You can enter the regular expression into the Annotations combo box, or select from predefined or saved regex formulas.

To add a favorite regex, use Add Regex, accessible by right-clicking in the combo box or clicking the menu icon

define annotation by regex dialog screenshot

For example:

All annotations:

.*

All annotations except Widget|Popup|Link

^(?!Link$|Widget$|Popup$).

All annotations except Popup

(?!Popup$).*

Markup annotations

Highlight$|^Underline$|^Squiggly$|^StrikeOut$

Test the regex on https://regex101.com/


Define by template option allows you to define more complex query for annotations. Select the option Add Template from the combo box menu.

define annotation by template dialog screenshot

In the Edit template dialog you can define conditions which annotations should be processed in the annot_update node. The system of defining conditions is the same like in the template panel.

Below you can find examples of commonly used templates. In the Edit template dialog choose the Plain Template option and replace the code with examples bellow.

Edit template dialog

Example 1: All annotations except hidden and invisible

{
    "template": {
        "annot_update": [
            {
                "query": {
                    "$and": [
                        {
                            "$0_annot_type": {
                                "$regex": ".*"
                            }
                        },
                        {
                            "$not": [
                                {
                                    "$0_annot_flag": {
                                        "$regex": "invisible"
                                    }
                                }
                            ]
                        },
                        {
                            "$not": [
                                {
                                    "$0_annot_flag": {
                                        "$regex": "hidden"
                                    }
                                }
                            ]
                        }
                    ],
                    "param": [
                        "pdf_annot"
                    ]
                },
                "statement": "$if"
            }
        ]
    }
}

Example 2: Link annotations with empty Contents key

{
    "template": {
        "annot_update": [
            {
                "query": {
                    "$and": [
                        {
                            "$0_annot_type": {
                                "$regex": "^Link$"
                            }
                        },
                        {
                            "$0_contents": ""
                        }
                    ],
                    "param": [
                        "pdf_annot"
                    ]
                },
                "statement": "$if"
            }
        ]
    }
}

Posted

in

,

Tags: