Creating Destinations by Text Search in PDF Documents
- Introduction
- This tutorial shows how to create destinations by text search in PDF documents using the AutoBookmark™ plug-in for the Adobe® Acrobat®. PDF destinations are named page views that can be used by links, bookmarks and external references to point to the specific page locations. The Adobe Acrobat provides only a manual way for creating named destinations. It is slow and impractical for large documents. The AutoBookmark adds a number automated methods for creating PDF destinations:
-
- By text search (via automated bookmarks, links or highlights generation)
- From existing links and bookmarks
- From a text file
- From Bates numbers
- It is a common task to create destinations for locations of the specific text or pattern within the PDF document. For example, if the document contains chapter titles such as "1.2 Chapter name", then named destinations can be generated for every possible chapter title present in the document. Each destination should point to the exact location of each chapter title. This can done by using a two-step procedure:
-
- Generate bookmarks by text search (or use any other available method)
- Create destinations from the bookmarks
- This operation is also available in the Action Wizard (Acrobat's batch processing tool) with the AutoBookmark™ Pro plug-in and can be used for processing multiple documents at once.
- 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 1: Generate Bookmarks By Text Search
- 1.1 Open a PDF Document
- Start the Adobe® Acrobat® application and open a PDF document using "File > Open..." menu.
- 1.2 - Open the "Bookmark Text Patterns" Dialog
- Select a sample text. It will be used to get text properties such as font name and size for automated bookmarking.
- Select "Plug-Ins > Bookmarks > Bookmark Text Patterns..." in the main menu to open the "Bookmark Text Patterns" dialog.
- 1.3 - Specify Text Pattern for Bookmarking
- Click "Add Level..." in the "Bookmark Text Patterns" dialog.
- Enter a text pattern (regular expression) into the "Find text pattern:" entry field. In this tutorial, we need to find text that matches the following format: "3.1 Chapter name". We use \d+\.\d+ [^\n]+ regular expression to do that. Here is a detailed explanation of this text pattern:
-
- \d+ - matches one or more digits.
- \. - matches a period character.
- \d+ - matches one or more digits.
- [^\n]+ - matches any character except of end-of-the-line. It will essentially match all text on the single line.
- In our example, chapter titles have a distinctive text style. It is possible to restrict text search only to text that uses a specific font name and/or size.
- Click the "Font Filter..." button in the "Bookmark Level Settings" dialog to restrict text search to a single font style.
- Check the "Match font name:" and "Match font size:" boxes in the "Select Font Filter" dialog. Click the "Set Font Attributes From Selected Text" button. The font name and style would be set based on a current text selection (see Step 1.2).
- Click "OK" to close the "Font Filter" dialog.
- Click "OK" in the "Bookmark Level Settings" to close the dialog.
- 1.4 - Generate Bookmarks
- Click "OK" in the "Bookmark Text Patterns" dialog to generate bookmarks.
- The confirmation dialog appears on the screen. Click "OK" to close the dialog.
- All chapter titles are now bookmarked:
- Step 2 - Generate Named Destinations
- Select "Plug-Ins > Destinations > Create from Bookmarks..." in the main menu to open the "Convert To Named Destinations" dialog.
- Click "OK" in the "Convert To Named Destinations" dialog to generate named destinations from the bookmarks.
- The confirmation dialog appears on the screen with the number of named destinations created. Click "OK" to close the dialog.
- Open Destinations panel to see the newly created destinations.
- Destinations point exactly to the same locations as the corresponding bookmarks.
- Note that bookmarks have been converted to use named destinations to point to the pages. The following example shows a bookmark action before and after the conversion.
- Bookmark action before the conversion:
- Bookmark action after the conversion:
- If this is not desirable and the bookmarks need to use the direct page references, then select "Plug-Ins > Destinations > Convert Bookmarks and Links Not To Use Destinations ..." from the main menu.
- Click "OK" in the "Convert Bookmarks and Links Not To Use Destinations" dialog to convert bookmark and link actions to use direct page references instead of named destinations.
- Step 3 - Delete Bookmarks (Optionally)
- If bookmarks are not desired, then delete them by selecting "Plug-Ins > Bookmarks > Delete All..." menu. Deleting the bookmarks is not going to affect destinations.
- Click "OK" to delete all bookmarks from the active PDF document.
- Click here for a list of all step-by-step tutorials available.