Bookmarks from Text Patterns

Overview

Bookmarks from Text Patterns searches the PDF for words, phrases, or regular expressions and creates bookmarks wherever matches are found. Each match becomes a bookmark pointing to the page where the text appears. This is useful for building a keyword index, marking recurring terms, or navigating to specific content.

Video: Bookmarks from Text Patterns shown step by step, with narration.
The Bookmarks from Text Patterns dialog
The Bookmarks from Text Patterns dialog.

How to use

  1. Open the PDF you want to search.
  2. Go to Plug-Ins > Bookmarks > Create & Add > Bookmarks from Text Patterns.
  3. Add rules using the Add button. Each rule specifies a search term (or regex), a bookmark level, style, color, and destination view.
  4. Configure the matching options and page range.
  5. Optionally click Preview to see proposed matches before committing.
  6. Click OK to create the bookmarks.

Rules

Rules are managed in a list. Each rule defines what to search for and how the resulting bookmark should look.

PropertyDescription
Term The word, phrase, or regular expression to search for.
Regex When enabled, the term is treated as a C++ regular expression.
Level The bookmark hierarchy level (1 = top level, 2 = child, etc.).
Custom title An optional title template. Supports tokens: {term} (the term; for a regular expression, the text it matched), {n} (the match's running number for its rule), {page} (the page number), {page_label} (the page label, or the page number if the page has none) and {page_n} (the match's number on its page).
Style Bookmark text style: Plain, Bold, Italic, or Bold+Italic.
Color Bookmark text color.
Destination view The zoom type for the bookmark destination (Inherit Zoom, Fit Page, Fit Width, Fit Height, Fit Visible, or Fit Rectangle).

Use the Add, Edit, Remove, Up, and Down buttons to manage the rule list. In Add, each line of Term(s) becomes a separate rule with the same settings, and a pattern picked from the Regex Library is added as a new line. Edit changes one rule, so its Term(s) box takes a single line.

Matching options

OptionDescription
Match whole words only Prevents partial matches — for example, “cat” will not match “catalog”. It applies to regular expression rules too: each match must start and end at a word boundary, so clear it for a pattern that begins or ends with a space or punctuation.
Match text case Enables case-sensitive matching.
Skip duplicate titles Creates only the first bookmark for each title. A later match that would produce a bookmark with exactly the same title as one already created is skipped; the first one is kept.
Match once per document Creates at most one bookmark per term in the entire PDF.
Match once per page Creates at most one bookmark per term per page.
Bookmark terms in listed order Orders the bookmarks by the rule list (all of the first rule's matches, then the second rule's, and so on) rather than by page.
Keep existing bookmarks Preserves the current bookmark tree. When unchecked, the new bookmarks replace the existing ones: you are asked first, and the existing bookmarks are removed only if at least one new bookmark is created.

Bookmark naming

ModeDescription
Raw term Uses the matched text as-is for the bookmark title.
Term with sequence Appends a running number to the term.
Term with page Appends the page number to the term.
Custom template Uses a user-defined template with the tokens {term}, {n} and {page}.

Page range

OptionDescription
To end of file Searches from the start page through the last page.
To page Searches up to and including the specified end page.
Custom range Enter a comma-separated list with ranges, e.g. 1-4,8,10-12.

Saving and loading rule lists

Use the Save List button to export your rules to a text file for later reuse. Use Open List to load a previously saved rule list; it replaces the rules already in the list, and you are asked first. A plain text file with one term per line is also accepted.

Tip

Use the Preview button to see how many matches will be found and where they occur before creating bookmarks. The preview shows up to 500 results. It describes the settings at the moment you click Preview: changing the rules, the page range option or the naming mode, or loading a configuration, clears it, so click Preview again after any change.

Warning

Clearing Keep existing bookmarks replaces all of the document's current bookmarks, including any unrelated to your patterns, once at least one new bookmark is created. You are asked first, and the change cannot be undone.

See also