Bookmarking Email Headers in PDF Files
Using AutoBookmark for Adobe® Acrobat®
- Introduction
- The tutorial shows how to bookmark email headers (To:, From:, Subject:, Sent:) in PDF documents. It is common to have multiple emails saved into the same PDF file. Bookmarking each email message significantly improves readability of such documents. It illustrates bookmarking text patterns functionality provided by AutoBookmark plug-in for Adobe® Acrobat®.
- The following screenshot explains what we are trying to accomplish. AutoBookmark searches every page of the PDF document for the specific text patterns that correspond to various email headers and bookmark those locations with hierarchical bookmarks.
- Prerequisites
- You need a copy of the Adobe® Acrobat® (Standard or Professional) 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. Note that plug-in does not work with free Acrobat® Reader.
- Text Patterns and Regular Expressions
- AutoBookmark uses regular expressions for text search. A regular expression (shortened as regex or regexp) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings. It is widely used in many text processing applications, word processors and search engines. There are countless websites devoted to regular expressions. We recommend using https://www.regular-expressions.info as a good source for reference information.
- Open PDF Document
- Start the Adobe® Acrobat® and open a PDF file you want to bookmark using “File > Open…” menu.
- Open "Bookmark Text Patterns" Dialog
- Use "File > Plug-ins > Bookmarks > Bookmark Text Patterns..." menu to open Bookmark Text Patterns dialog.
- Add First Bookmarking Level: "Sent" Header
- Press "Add Level..." button to add definition for the first bookmark level. Lets use "Sent:" headers for the first level bookmarks. Type the following search expression into Find text patterns box:
-
(?<=Sent: )[^\n]+
- This expression searches for Sent: keyword and extracts all text that follows it until end of the line. Note that Sent: is not included into the bookmark title. We are using a special regular expression syntax called positive-lookbehind to match a specific text but exclude it from the resulting match: (?<=Sent: ). If you want to learn more about regular expression syntax, press "?..." button next to the "Fint text pattern" entry field.
- Add Second Bookmarking Level: "Subject" Header
- Press "Add Level..." button to add definition for the second bookmark level. Lets use "Subject:" headers for the second level bookmarks.
- Type the following search expression into Find text patterns box:
-
^Subject: [^\n]+
- This expression searches for Subject: keyword (it should start at the begining of a line) and extracts all text that follows it until end of the line. Note that Subject: is included into resulting bookmark title.
- Add One More Second Level: "From" Header
- Press "Add Level..." button to add definition for another second bookmark level based on "From:" headers.
- Important: since we want to add another second level, we must manually set bookmarking level to 2 (it is auto-incremented to 3).
- Type the following search expression into Find text patterns box:
-
^From: [^\n\[]+
- This expression searches for From: keyword (it should start at the begining of a line) and extracts all text that follows it until end of the line. Note that From: is included into resulting bookmark title. In addition, it will not include any text that starts with a square bracket - [. This is necessary to exclude duplicate email addresses that after included into the header.
- You can repeat the last step for other email headers. The following screenshot shows the Bookmark Text Patterns dialog after adding 3 second-level bookmarking definitions based on Subject, From and To email headers.
- Running Bookmarking
- Press OK button on Bookmark Text Patterns dialog to start bookmarking. You should see bookmarks displayed in the Bookmark pane after processing is finished.
- Loading Settings From File
- Use “Save To File” and “Load From File” buttons to save bookmarking settings into a file. You can load settings later or share them with co-workers.
- Use the following link to download settings file for the current tutorial. Use "Load File..." button to load settings from the BookmarkEmails.abtp file after it is downloaded.