Bookmarking Text Patterns in PDF Documents

AutoBookmark Plug-in for Adobe® Acrobat®

Introduction
Use Bookmark Text Patterns operation provided by AutoBookmark plug-in for Adobe® Acrobat® to automatically create multi-level bookmarks based on text search. Utilize this operation to bookmark text that conforms to the specific text pattern(s) such as account and invoice numbers, part numbers, chapter headings, etc.
Examples of Text Patterns
Text pattern is a sequence of characters that conform to a certain set of rules that makes it different from other text in the document. Here are few examples of common text patterns:
  • Various ID numbers: Capital letter that is followed by 6 or more digits (A123985 or A0388277272)
  • US Social security numbers or EINs (123-45-6789 or 53-1234567)
  • Phone numbers in various formats ((503)-738-1234 or +34 678009123)
  • Amazon order numbers (Order # 303-5552426-8452123)
  • Product codes or SKUs (ABC-1223578 or 12345WER-003)
Regular Expressions
A regular expression, is a sequence of characters that specifies a match pattern in text. AutoBookmark uses this syntax to perform a text search to find text that needs to be bookmarked. Regular expressions are widely used by string-searching algorithms in most text processing applications for "find" or "find and replace" operations. There are many tutorials and resources available online.
Tutorial Overview
The following tutorial shows how to take a PDF document with multiple invoices and create hierarchically structured multi-level bookmarks. The "billing" type would be at the first level, and invoice numbers – at the second level. Bookmarks will be arranged by the "billing" type. The resulting bookmark structure provides an effiient way to review and navigate the document content.
Input Document Description
The input PDF document contains multiple invoices of variable page length. First page of each invoice contains an invoice number and one of the 3 different labels - COD, CORPCOD and CORPORATE ("billing" type).
Bookmarking Approach
Invoices always has an invoice number somewhere on the page. We are going to use the "Bookmark Text Patterns" function provided by the AutoBookmark® plug-in to create multiple-level bookmarks based on a billing type and invoice numbers. The "billing type" bookmarks will be created at the first level, while invoice numbers – at the second level.
This operation is also available in the Action Wizard (Acrobat's batch processing tool) and can be used for automated processing of multiple PDF documents at once.
This tutorial contains an advanced topic that shows how to create and use multiple text patterns for each bookmarking level. The order of the patterns can be used to produce different bookmarking results.
Prerequisites
You need a copy of the Adobe® Acrobat® along with the AutoBookmark™ plug-in installed on your computer in order to use this tutorial. You can download trial versions of both the Adobe® Acrobat® and the AutoBookmark™ plug-in.

Step-by-Step Tutorial

Step 1 - Open a PDF File
Start the Adobe® Acrobat® application and open a PDF file using "File > Open…".
Step 2 - Open the "Bookmark Text Patterns" Dialog
Select "Plug-Ins > Bookmarks > Bookmark Text Patterns…" to open the "Bookmark Text Pattern" dialog.
[⚡ How to locate Plugins menu ⚡].
Step 3 - Add First Bookmark Level
Press the "Add Level…" button to create description of the first bookmark level. The "Bookmark Level Settings" dialog is going to appear on the screen.
Press add level button
Step 4 - Configure First Bookmark Level Settings
The bookmark level will be automatically set to the level "1 (Top Level)". Specify text pattern by entering COD|CORPCOD|CORPORATE as a regular expression for the first bookmark level. This text pattern will bookmark any page that contains any of these labels: "COD", "CORPCOD", "CORPORATE". Check the "Match text case" box. Click "OK" once done.
Specify text pattern for the first bookmark level
Step 5 - Add Second Bookmark Level
Press the "Add Level…" button to enter a description of the second bookmark level. The "Bookmark Level Settings" dialog is going to appear on the screen.
Press add level button
Step 6 - Configure Second Bookmark Level Settings
The bookmark level will be automatically set to the level "2". Specify text pattern by entering Invoice Number: \d+ as a regular expression for this bookmark level. All occurrences of "Invoice Number: XXXXXXX" (where XXXXXX is a number) will be bookmarked by this text pattern. Click "OK" button once done.
Specify text pattern for the second level
Step 7 - Start the Bookmarking Process
Now you should see two entries in the "Bookmark Levels Settings" list. One for each bookmark level. Optionally, press the "Save To File…" button to save bookmarking settings into a settings file (*.abmp extension). This file can be loaded and reused later. Click "OK" button to start bookmarking.
Press OK button to start bookmarking
Step 8 - Examine the Results
The AutoBookmark™ plug-in automatically created two-level bookmarks for each invoice page: first level – a billing type; second level – an invoice number.
Examine results
Advanced Topic: Using Multiple Text Patterns for each Bookmarking Level
It is possible to use multiple text patterns for each bookmarking level. The order of the text patterns (for each level) control the order in which text patterns are applied and bookmarks are created. Changing the order of the text patterns may result in different bookmarking results and provides an additional control over the bookmarking process. Click on desired bookmark pattern in the "Bookmark Text Pattern" dialog to select it. Click "Edit" to open the "Bookmark Level Settings" dialog.
Set bookmark level
Specify the bookmark level in the "Bookmark level" box. It is possible to provide multiple different patterns for the same bookmarking level. This allows creating of more sophisticated bookmarking rules.
The order of the patterns in the list now matters and can be used to get different bookmarking results when bookmarked text is located on the same page. Each pattern is applied sequentially in the order it is listed. Click on a text pattern in the "Bookmark Levels" list to select it. Click "Move Up" and "Move Down" buttons to change text pattern order in the list. 
For example, consider a PDF document that contains on each page 5 text "lines" of text: Product, Description, Overview, Price, Weight. If there are 5 text patterns in the "Bookmark Levels" list:
  • 1. Level 1: Product
  • 2. Level 2: Description
  • 3. Level 1: Overview
  • 4. Level 2: Price
  • 5. Level 2: Weight
Then the output bookmarks will look like as:
However, if the order of these 5 text patterns is different:
  • 1. Level 1: Product
  • 2. Level 1: Overview
  • 3. Level 2: Description
  • 4. Level 2: Price
  • 5. Level 2: Weight
Then the output bookmarks will be generated in a different order:
Here is another example if the order and levels of these 5 text patterns are different:
  • 1. Level 1: Overview
  • 2. Level 2: Description
  • 3. Level 3: Price
  • 4. Level 2: Weight
  • 5. Level 2: Product
Then the output bookmarks will look like as follows:
Click here for a list of all step-by-step tutorials available.