Generate Bookmarks From Text Styles Using a Command-line BAT File
Introduction
It’s possible to run some AutoBookmark Pro operations from outside of Adobe Acrobat via a command-line BAT file. In this tutorial, we will create a BAT file that generates PDF bookmarks based on text styles, using the AutoBookmark™ plug-in. Use this method to automatically generate multi-level bookmarks from text attributes such as font style, text size, indentation or a text pattern. All text that matches a specified font or text size will be automatically bookmarked.
The first step involves configuring the desired AutoBookmark bookmarking operation. Here, we will create and save a bookmarking settings profile which will feature as a component of the BAT file. The second step is to create the BAT file – when executed, the relevant settings will be executed on a specified input file. Once created, BAT files can be executed by double clicking on them. The relevant input file(s) will be processed, using a saved settings profile, with the output file(s) saved to a chosen output folder.
The bookmarking settings used here will create bookmark trees for any text in the input PDF that matches x2 text profiles:
sample bookmarked styles
Prerequisites
You need a copy of Adobe® Acrobat® along with the AutoBookmark™ plug-in installed on your computer in order to use this tutorial. Both are available as trial versions.
Step 1 - Create a Settings File
The first step is to create a settings profile that will be used to generate bookmarks from matching text styles. Click here here to view a more detailed tutorial on how this procedure can be configured.
With the PDF to be processed open in Acrobat, select "Plug-Ins > Bookmarks > Generate From Text Styles" from the main menu.
open bookmarking dialog
Configure the desired settings, then press "Save...".
configure bookmarking settings
Choose a folder and rename the file, which will be saved with an *.abm extension. We will save this example as "Settings.abm" in the C:\Data folder.
Press "Save" to proceed.
save settings profile
Step 2 - Create the BAT File
See the separate tutorial for detailed help on running an operation from a command-line BAT file.
Create a BAT file using any plain text editor (such as Notepad). Begin by creating a blank text file, then add the following lines making sure to replace file paths and filenames with the relevant filenames you are using.
SET AUTOBOOKMARK_INPUT_FILE=c:\Data\State Courts.pdf
SET AUTOBOOKMARK_CONFIG_FILE=C:\Data\Settings.abm
SET AUTOBOOKMARK_OUTPUT_FOLDER=C:\Data\Output
SET AUTOBOOKMARK_LOG_FILE=C:\Data\AutoBookmarkLog.txt
SET AUTOBOOKMARK_BAT_ENABLE=ON
SET AUTOBOOKMARK_MODE=AutoBookmark_GenerateBookmarks
"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /n /h
Press "File > Save As..." to save the text as a BAT file. Notepad prompts you to save the text as a *.txt file. Choose a folder and use the "Save as type:" list to select "All Files". Name the file and manually add a *.bat file extension, then press "Save".
You can find a list of other step-by-step bookmarking tutorials by clicking here.