Linking to Page Labels in Another PDF File

Tutorial for AutoBookmark Plug-in for Adobe® Acrobat®

AutoBookmark plug-in allows automatic linking of text from one PDF document to page locations in another PDF document using page labels. Page labels are aliases that can be assigned to pages in PDF document to allow complex page numbering schemes. For example, it is possible to mix Roman numerals for one part of the document with alphanumeric page labels in another. Page labels can be assigned in Page Thumbnails panel in Adobe Acrobat. The following tutorial assumes we have one document named Index.pdf with text that references page labels in another document Book.pdf. The goal is to automatically add links to text in Index.pdf that will open a corresponding page in Book.pdf.
Source and Destination PDF Files
The following screenshot shows page labels in the destination document (Book.pdf). Page labels start with a capital letter and is followed by 1-3 digits. For example: A2, A45, A101, A230 etc.
Page labels in the destination document
The next screenshot shows references to page labels in Book.pdf from another document (Index.pdf). The goal is to automatically add links to these references that will open corresponding page locations in Index.pdf in the another window.
References to Page labels in the source document
Generating Links to Another PDF File
Open the document you want to add links to (in our sample case it is Index.pdf) using File > Open... menu.
We are going to use linking by text search. Select Plug-ins > Links > Generate Links > Generate Links by Text Search (Single Rule) from the menu to open Generate Links by Text Search dialog:
Generate Links by Text Search dialog
Enter the search pattern into Find what: box. In our case (letter followed by 1-3 digits), the regular expression is \b([A-Z]\d{1,3})\b. Regular expressions is a special syntax that is widely used to describe text patterns. There are copious resources on Internet devoted to explanation of regular expressions.
Explanation of the search expression:
  • \b - match a "word" boundary. This is necessary to match only standalone patterns that are not part of a longer text. This is necessary to prevent matching ABC32323 and match only A1, A23, A230.
  • [A-Z] - match a single letter from A to Z.
  • \d{1,3} - match 1-3 digits
  • \b - match a "word" boundary. This is necessary to make sure there are no more digits after initial 1-3. It is necessary to prevent matching a substrings in longer patterns.
Enter linking expression into Link action: box. We are using file://Book.pdf,plabel:\1,NewWindowYes to link to page labels in Book.pdf file located in the same folder as our current document (Index.pdf).
Explanation of the linking action:
  • file://Book.pdf - the links should point to locations inside Book.pdf located in the same folder as current document. If Book.pdf is located in the sub-folder then modify the relative path to the file. For example: file://Refs/Book.pdf. This instructions will point to Book.pdf located in Refs subfolder. IMPORTANT: file:// keyword should appear first in the link action prior to plabel: keyword.
  • plabel: - the text that follows this keyword is going to be interpreted as page label.
  • \1 - use first matching group from the search pattern. Matching group is a part of the regular expression enclosed in (...). In our case, it is a text that is matching ([A-Z]\d{1,3}). It means that \1 will be replaced with actual page label - A10, A20, A100 etc.
  • NewWindowYes - the link will open a referenced page in a new window. If you need to open destinations in the same window, then use NewWindowNo instead.
Now configure the rest of the linking settings such as processing page range and link appearance. Press OK button to start linking.
Inspect the Results
Click on the resulting links to test their behavior. IMPORTANT: If a specific page label is not present in the document, then link will be made to first page of the document. Note that links are made to the physical page numbers that correspond to the page labels. PDF file format does not allow using page labels themselves in the link parameter. If make modifications to the destination document by insterting or deleting pages, then these external links will not point to correct pages. If you need to have links that are unaffected by changes in the destination document, then use named destinations for linking. Named destinations are named pages views that can be used to refer to locations in another documents. They do not change even if page order is modified.
Linking to Page Labels in the Same Document
You can use exactly the same procedure to link to page labels within the same PDF document. Just remove file://.... keyword from the link action. This will create links to the pages within the same document.