Using a Command-line BAT File to Create Bookmarks Via a Control 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 adds bookmarks to an input PDF document using instructions detailed within a plain text control file.
- 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 used to add bookmarks to an input file. Once created, run BAT files by double clicking on them. The relevant input file(s) will be processed, using the saved settings profile, with the output file(s) saved to a chosen output folder.
- The bookmarking settings used here will search all text in an input document, and add bookmarks based on a bookmarking structure defined within the control file. Click here to view a more detailed tutorial on how this procedure can be configured.
- 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 via a control file. Click 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 > Create from Text File..." from the main menu.
- Configure the desired settings, then press "Save Settings...".
- Choose a folder and rename the file, which will be saved with an *.abtxt extension. We will save this example as "Settings.abtxt" in the C:\Data folder.
- Press "Save" to proceed.
- 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.abtxt
SET AUTOBOOKMARK_OUTPUT_FOLDER=C:\Data\Output
SET AUTOBOOKMARK_LOG_FILE=C:\Data\AutoBookmarkLog.txt
SET AUTOBOOKMARK_BAT_ENABLE=ON
SET AUTOBOOKMARK_MODE=AutoBookmark_BookmarkFromTextFile
"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.