Search and Replace PDF Link and Bookmark Actions
Introduction
This tutorial shows how to use search and replace PDF link and bookmark actions using the AutoBookmark™ plug-in for the Adobe® Acrobat®.
Use this tool to:
  • Change web URLs in "Open a weblink" actions
  • Change external file references in "Open a file" and "Go to a page in another document" actions
  • Modify named destinations references in "Go to a page" and and "Go to a page in another document" actions
  • Modify Acrobat JavaScript code in "Execute JavaScript" actions
For example, all links and bookmarks can be re-targeted to point from one web page to another or to change references from one file to another. This operation processes both links and bookmarks. This tool cannot be used to change link/bookmark action types. It is designed to change properties of the PDF actions such as URLs, file paths, destination names and JavaScript code.
This operation is also available in Action Wizard (Acrobat's batch processing tool) and can be used for automating of document processing workflows.
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.
Step 1 - Open a PDF File
Start the Adobe® Acrobat® application and open a PDF file using “File > Open…”.
Step 2 - Open the "Search And Replace Link Actions" Dialog
Select “Plug-Ins > Links > Search and Replace Actions…” to open the "Search And Replace Link Actions" dialog.
Step 3 - Specify Operation Settings
This operation has two different modes of operation. In the first mode, a single pair of search and replace expressions is used for processing. The second mode allows using multiple search and replace expression pairs.
Mode 1 - Single Search/Replace Expression
The tool allows to select one or more types of link actions that need to be processed:
- web page references
- external file references
- references to named destinations (local and external)
- JavaScript code
Changing Web Page References
Check the “Web page references” box to search and replace web page addresses (URLs). Specify “Find what:” and “Replace with:” boxes as required. For example, enter the following parameters to change all references from https://www.justice.gov to https://www.justice.gov/publications/resources.
Specify "Find what:" https://www.justice.gov
Specify "Replace with:" https://www.justice.gov/publications/resources
Click "OK" to start the process.
The dialog will show the total number of links modified. Click "OK".
All links that contain https://www.justice.gov in the URL specification will be processed and changed to https://www.justice.gov/publications/resources.
Changing External File References
Check the “External file references” box to search and replace external file references. Specify “Find what:” and “Replace with:” boxes as required. For example, enter the following parameters to change file references from Sample files/Samples/COLR.docx to COLR.docx. Optionally, uncheck "Match case"
Specify "Find what:" Sample files/Samples/COLR.docx
Specify "Replace with:" COLR.docx
Click "OK" to start the process.
The dialog will show the total number of links modified. Click "OK".
All links that refer to a specified external file will be processed.
File references can be used in the following PDF actions:
- Go to a page in another document
- Play move, sound and open a file
Please note that you need to check both "Web page references" and "External file references" options while performing file paths updates. It is possible to use URL in PDF format to point to a local file. For example, only URLs that start with http: and https: are treated as web references. All other URLs are treated as local file references.
Changing References To Destinations
Check the “References to named destinations (local and external)” box to search and replace references to named destinations. Specify “Find what:” and “Replace with:” boxes as required. For example, enter the following parameters to change destination references from "F" to "Figure".
Specify "Find what:" F
Specify "Replace with:" Figure
Click "OK" to start the process.
The dialog will show the total number of links modified. Click "OK".
All links that contain references to named destination "F" are now changed to "Figure".
Mode 2 - Using Multiple Search And Replace Expressions
The tab-delimited text file is used to store multiple input search and replace pairs. The second method is useful when it is necessary to repeatedly perform multiple different search and replace operations.
The control file can be created by using any plain text editor (such as Notepad) or Microsoft Excel spreadsheet editor. The control file contains a single search and replace expression per text line. Tab symbol is used to separate fields in each line. There are 3 fields: "Find what", "Replace with" and "Search Settings".
The "Search settings" field can contain any combination of the following 3 letters or be an empty field:
  • r - use regular expressions for search and replace fields.
  • c - search is case-sensitive.
  • w - search only for whole words matches.
Control File Example:
Select types of link action that need to be processed. Check the "Use text control file to perform multiple search and replace operations at once" box.
Click “Browse…” to specify a text control file location. Optionally, click “Open in Text Editor…” to edit a text control file. Click "OK" to start the process.
Review the Results
The dialog will show the total number of links modified. Click "OK".
Summary: the control file has been used to search and replace multiple different link properties.