Run PDF Validation

How to Create Accessible PDF

Annotations

Bookmarks

Accessibility

Tags

Content

Layout Template

Workspace

Table Tool

No headings found in this post.

Selection tools

SDK Actions

Preferences

Thumbnails

No headings found in this post.

Fonts

No headings found in this post.

PDF Conversion

Browser

No headings found in this post.

Destinations

License

How to Define Annotations

Missing help

No headings found in this post.

PDFix Actions Pipeline

External Actions

How to Define Tags

How to Define Content

Tag Tool

Basic Actions

How to Define Annotations

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"
            }
        ]
    }
}
{
    "template": {
        "annot_update": [
            {
                "query": {
                    "$and": [
                        {
                            "$0_annot_type": {
                                "$regex": "^Link$"
                            }
                        },
                        {
                            "$0_contents": ""
                        }
                    ],
                    "param": [
                        "pdf_annot"
                    ]
                },
                "statement": "$if"
            }
        ]
    }
}

Example 3: All annotations with specific box

This template matches annotations on page 1 that are small in size (width and height <= 14 points). It’s useful for identifying decorative or icon-like annotations (e.g. small link icons, UI hints) that might not require detailed alternative text for accessibility.

{
  "template": {
    "annot_update": [
      {
        "query": {
          "$and": [
            {
              "$0_width": {
                "$lte": "14"   // width less than or equal to 14 pt
              }
            },
            {
              "$0_height": {
                "$lte": "14"   // height less than or equal to 14 pt
              }
            },
            {
              "$page_num": "1" // only match annotations on page 1
            }
          ],
          "param": [
            "pdf_annot"
          ]
        },
        "statement": "$if"
      }
    ]
  }
}

Leave us a Question or Comment

Posted

in

,

Tags: