Search and Replace PDF Bookmarks Using The AutoBookmark™ Plug-in For The Adobe® Acrobat®
Introduction
This tutorial shows how to search and replace bookmark titles in PDF documents using the AutoBookmark™ plug-in for the Adobe® Acrobat®. The plug-in allows to make text substitutions in the bookmark titles or to add text before and/or after existing bookmark titles.
These operations are also available in the Action Wizard (Acrobat's batch processing tool) and can be used for automating of document processing workflows.
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.
Find And Replace Bookmark Text
This operation has two different modes of operation. In the first mode, a single pair of search and replace text strings is used to rename bookmarks. The second mode performs multiple search and replace operation. The tab-delimited text control file is used to store search and replace text.
A Single Search And Replace Expression
Step 1 - Open a PDF File
Start the Adobe® Acrobat® application and open a PDF file using “File > Open…”.
Step 2 - Open the "Replace Bookmark Text" Dialog
Select "Plug-Ins > Bookmarks > Modify Bookmarks > Find and Replace Text…" to open the "Replace Bookmark Text" dialog.
Step 3 - Specify Processing Options
Enter a text to search for into "Find what:" field.
Enter a replacement text into "Replace with:" field.
Optionally, use regular expressions to search and replace text patterns. "Regular expressions" is a special language for describing text patterns. It provides ability to perform a generalized search and replace operation that otherwise might take hundreds or thousands of individual search and replace actions.
Here are some examples of search and replace patterns with regular expressions:
Step 4 - Start the Process
Click "OK" to start searching and replacing bookmark text. For example, we are going to replace bookmark text "Pict." with "Picture".
Step 5 - Check the Bookmarking Stats
The number of bookmarks that have been modified will be displayed. Click "OK" to finish.
Step 6 - Examine the Results
In the following example all occurrences of "Pict." have been replaced by "Picture".
Multiple Search And Replace
Step 1 - Open a PDF File
Start the Adobe® Acrobat® application and open a PDF file using “File > Open…”.
Step 2 - Open the "Replace Bookmark Text" Dialog
Select "Plug-Ins > Bookmarks > Modify Bookmarks > Find And Replace Text…" to open the "Replace Bookmark Text" dialog.
Step 3 - Select an Input Control file
Check the "Use text control file to perform multiple search and replace operations at once" option. This option allows using a tab-delimited text control file that contains descriptions of search and replace expressions and options. Press the "Browse..." button to select an input control file. The control file can be created by using any plain text editor (such as Notepad) or Microsoft Excel.
Step 4 - Edit the Control File (Optionally)
Optionally, click "Open in Text Editor...".
The selected control file will be opened for viewing and editing. Each line in the control file contains a single search and replace expression. There are 3 fields in the expression: "Find what", "Replace with" and "Search Settings". The "Tab" key is used to separate fields.
Search settings is any combination of the following 3 letters or an empty string:
r - use regular expressions,
c - search is case-sensitive,
w - search only for whole words matches.
Here is the control file used in this example. It provides 5 different search and replace expressions.
Step 5 - Perform Search and Replace
Click "OK" to start searching and replacing bookmark text.
Step 6 - Check the Bookmarking Stats
The number of bookmarks that have been modified will be displayed. Click "OK" to finish.
Step 7 - Examine the Results
The software has used the control file to perform multiple search and replace operations:
Adding Prefix/Suffix To Bookmark Titles
Step 1 - Open a PDF File
Start the Adobe® Acrobat® application and open a PDF file using “File > Open…”.
Step 2 - Open the "Add Prefix/Suffix" Dialog
Select "Plug-Ins > Bookmarks > Modify Bookmarks > Add Prefix/Suffix To Bookmarks…" to open the "Add Prefix/Suffix" dialog.
Step 3 - Specify Prefix/Suffix Settings
Enter a text to add before and/or after existing bookmark title. For example, we are going to add prefix "Mr. " and insert page number that the bookmark are referring to as suffix to all bookmarks. Type "Mr. " into the "Insert before each title" entry box and " (page {page})" into the "Append after each title" entry box. Then each bookmark title will appear as: "Mr. ........ (page N)".
You can add both "static" text (exactly as you type it) or use various keywords. The sofware can insert page numbers, Bates numbers, named destinations, bookmark levels, web addresses and file names that the bookmarks are refering to.
Step 4 - Start the Process
Click "OK" to start searching and replacing bookmark text.
Step 5 - Examine the Results
The "Mr. " preffix has been inserted in begining of each bookmark title.
"Page N" suffix has been appended at the end of each bookmark title.
Inserting Bates Numbers Into Bookmark Titles
The software provides functionality for inserting Bates numbers into existing bookmark titles. If a bookmark points to a page that has an assigned Bates number, then it is possible to extract it and insert anywhere in the corresponded bookmark. For example, type {bates} into the "Insert before each title" entry box. The corresponding Bates number will be inserted in the beginning of each bookmark title.