Generate PDF Links By Text Search Using The AutoBookmark™ Plug-in For The Adobe® Acrobat®
Introduction
This tutorial shows how to automatically generated PDF links by text search using the AutoBookmark™ plug-in for the Adobe® Acrobat®. The "Link by Search" operation finds text that matches a user-specified text pattern and adds links based on a user-specified action description. The regular expressions are used to define text patterns. Regular expressions is a widely used syntax for describing text patterns and performing powerful search operations.
Prerequisites
You need a copy of 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.
Examples:
Step 1 - Open a PDF File
Start the Adobe® Acrobat® application and open a PDF file using “File > Open…”.
Step 2 - Open the "Generate Links By Text Search" Dialog ↑overview
Select “Plug-Ins > Links > Generate Links > Generate Links By Text Search (Single Rule)” to open the "Generate Links By Text Search" dialog.
Step 3 - Specify Page Area (Optionally) ↑overview
Press "Edit Page Area..." button to specify an area on the page to perform a text search. All text outside of the specified area will be ignored.
Check the "Process text located only in the following area" box. Click “Select Page Area From Sample Page…”.
Click and hold the left mouse button while using the Selection tool, then draw a rectangle around an area on the sample page.
Step 4 - Specify Link Appearance (Optionally) ↑overview
Press "Edit Appearance..." button to specify desired visual appearance of the resulting links.
Select a link type: visible or invisible rectangle. Select "Invisible Rectangle" if you don’t want users to see the link in the PDF. An invisible link is useful if the link is over an image. Note that the "Line Thickness", "Line Style" and "Color" options are not available if "Invisible Rectangle" is selected.
Select a highlight style: none, invert, outline or inset.
None: doesn’t change the appearance of the link.
Invert: changes the link’s color to its opposite.
Outline: changes the link’s outline color to its opposite.
Inset: creates the appearance of an embossed rectangle.
Select a line thickness: thin, medium or thick.
Select a line style: solid, dashed or underline.
Select a color for the link using the "Color" menu. The color is used only for drawing the link outline. Check the "Change underlying text color to" box and select a desired color from the pull-down menu. Click "OK" to close the dialog.
Step 5 - Specify Search Parameters ↑overview
Specify search parameters. The "Find text pattern" and "Link action" parameters fully control what text will be linked using what link action. The "Find text pattern" expression defines a regular expression that is used to search for a text that would be "receive" a link. The "Link action" field determines what happens when a reader clicks on a link. Below are examples of typical link generation tasks.
Common Link Generation Scenarios:
Adding Links To a Single Web Page ↑overview
The following examples illustrates how to automatically add links to a single web page. For example, link every occurence of "U.S. Department of Justice" text to "https://www.justice.gov" web address:
Specify "Find text pattern:" U.S. Department of Justice
Specify "Link action": URI:https://www.justice.gov
Click "OK" once done.
The dialog will show the total number of links created. Click "OK".
The plug-in automatically adds links to the user-specified web-address from all occurrences of the matched text:
Adding Web Links To Different Web Pages (Online Catalog Example) ↑overview
It is a common task to generate web links to online "product" pages based on some kind product index or SKU. For example, if website www.mystore.com has a number of product pages that have SKU as a part of the name, then it is possible to automatically add links to SKUs in the PDF document. Let's assume that SKU is formatted as a single letter that is followed by a 10 digit number (A1234567890 or F1392493420). There are corresponding web pages with the following URLs: www.mystore.com/A1234567890 and www.mystore.com/ F1392493420. Use the following settings to automatically add web links to every occurrence of SKU in the PDF document:
Specify "Find text pattern": ([A-Z]\d{10})
Link action: URI:http://www.mystore.com/\1
Click "OK" once done.
The dialog will show the total number of links created. Click "OK".
The "Find text pattern" expression will match  a single letter ([A-Z]) that is followed by a 10 digit number (\d{10}). The whole expression is enclosed in round brackets ( ) to allow referring back to the search results in the link action. The "Link Action" starts with URI: prefix. It indicates an "Open a web link" action. It is followed by a static portion of the web address: http://www.mystore.com/ which is always the same for all links. Next, it is followed by the search results returned by the first matching group (expression enclosed with round brackets) \1. If text search has located F1392493420 SKU in the text, it will add a web link with the following URL: http://www.mystore.com/F1392493420.
Adding Links To Pages (Using Page Numbers) ↑overview
Quite often it is necessary to add a page link to "see page N" text, where N is a page number. Use the following expressions to accomplish that. Page numbers are expected to be just a series of digits.
Specify "Find text pattern": see page (\d+)
Specify "Link action":  \1
Click "OK" once done.
The dialog will show the total number of links created. Click "OK".
The \d+ in "Find text pattern" is a regular expression for matching one or more digits. The \1 in "Link action" refers to a text that is matched by a first sub-pattern (\d+) in the "Find text pattern" expression. A sub-pattern is a set of characters enclosed by brackets. For example, when this operation encounters "see page 3" text string, it will use "3" for a link action. This is a most basic link action that refers to a page number.
Adding Links To Pages (Using Page Labels) ↑overview
PDF document may have logical page labels assigned to pages in the "Thumbnails" panel. The page labels can be used in the page selector and provide a more flexible way to page numbering in PDF documents. Page labels can use any combination of characters, symbols and digits. The following example shows how to add page links to "see page A-14" or "see page B-17" text references.
Specify "Find text pattern": see page ([A-Z][-]\d+)
Specify "Link action": plabel:\1
Click "OK" once done.
The dialog will show the total number of links created. Click "OK".
The [A-Z][-]\d+ in "Find text pattern" is a regular expression for matching a letter (any letter from A to Z) that is followed by a dash and then by one or more digits. For example, A-14, B-17 and etc. The plabel: keyword indicates that the text that follows it is a page label (\1). The \1 refers to matching results from [A-Z][-]\d+. See the following tutorials on assigning page labels.
Adding Links To Pages With a Page Offset ↑overview
It is often necessary to add a page link to "see page N" text with a page shift. Page shift is a difference between a number in the text and a real page number in the PDF document. Sometimes, printed page numbers do not match "physical" page numbers in a PDF file. For example,  "see page 3" needs to point to page 13 in the PDF document. This means that we cannot directly use a page number extracted from a text to refer to a specific page. The page offset comes to the rescue. Page offset can be either a positive or negative integer that is added to the page number specified in a "Link action" string before creating a page link. If you need to specify a negative page offset then type +-10. The example below assumes that there is an offset of 10 pages between printed and physical page numbers.
Specify "Find text pattern": see page (\d+)
Specify "Link action": \1, +10
Click "OK" once done.
The dialog will show the total number of links created. Click "OK".
The \d+ in the "Find text pattern" is a regular expression for matching one or more digits. The \1 in the "Link action" refers to a text that is matched by a first sub-pattern (\d+) in the "Find text pattern" expression, +10 is appended to the end of a link action description. For example, when "see page 3" text string is encountered, a link to page 13 is added and etc.
Adding Links To Named Destinations ↑overview
This example shows how to add links to "see page XX" text, where XX is a reference to a named destination. The "named destination" or just "destination" is a named page view that can be created in the "Destinations" panel. The following example assumes that PDF document has named destinations and document text contains text such as "see page AB234" or "see page 254A", and where AB234 and 254A do actually exist as destinations in the current PDF document.
Specify "Find text pattern": see page (\w+)
Specify "Link action": @Page\1
Click "OK" once done.
The dialog will show the total number of links created. Click "OK".
The \w+ in "Find text pattern" is a regular expression for matching one or more "word" characters (letter, digit or underscore). It matches any alphanumeric page number that contains only letters or digits (such as A1, D23 and etc.) The \1 in the "Link action" refers to a text that is matched by a first sub-pattern (\w+) in the "Find text pattern" expression. A sub-pattern is a set of characters enclosed by brackets. For example, when this operation encounters "see page A53" text, then it will use @PageA53 as a link action. This is a link action that refers to a named destination PageA53. The @ symbol is used to designate named destinations.
Adding Links To External Files ↑overview
For example, use the folliwing parameters to add file links to every occurence of the "catalog XXXXXX" text, where XXXXX represents a full or partial name of the corresponding file.
Specify "Find text pattern": catalog (\w+)
Specify "Link action": file://\1\.pdf
Click "OK" once done.
The dialog will show the total number of links created. Click "OK".
The \w+ in "Find text pattern" is a regular expression for matching one or more "word" characters (letter, digit or underscore). This expression finds all occurences of word "catalog" that is followed by an alphanumeric name (may contain letters, digits and underscore only). The \1 in "Link action" refers to a text that is matched by a first sub-pattern (\w+) in the "Find text pattern" expression. A sub-pattern is a set of characters enclosed by brackets. For example, when this operation encounters "catalog B200" text string, it will use "file://B200.pdf" as a link action. This link action refers to a file B200.pdf located in the same folder as a current PDF document.
Important: Always save file to its intended location prior to using this operation to make sure all links are pointing to a correct folder.