How to define Annotations

Table of Content:

Workspace

Preferences

PDFix Actions

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.

Check annotation types

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

Predefined annotation sets

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.

Define annotations by Regex

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

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 annotations by Template

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

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.

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:


You might also like