Automating PDF Processing

AutoBatch plug-in for Adobe® Acrobat®

Introduction
The AutoBatch™ adds a command-line batch file functionality to the Adobe® Acrobat® Pro software. It allows users to execute any existing Action Wizard "action" from a command-line batch file and pass custom input/output file or folder paths as parameters.
The following tutorial explains how to use the software to create command-line BAT file for the Acrobat's Action Wizard processing action and use it to automate PDF document processing.
You need to have Adobe Acrobat Professional and AutoBatch plug-in installed on the computer in order to use this tutorial.
Create New or Edit Existing Action Wizard Action
AutoBatch does not really have any PDF processing functionality by itself, it is executing existing Action Wizard “actions”. “Action” is a set of processing steps that can be performed on a PDF files. "Actions" can be created using Action Wizard tool that comes with Adobe Acrobat Professional. The very first step is to either create a new “action” or edit (if necessary) an existing action. Each action defines not only one or more processing operations that need to be performed on PDF file(s), but also specifies what files or folders are being processed and where to save the output files. Examples of the actions include optimizing scanned PDF files, reducing file size, converting files to PDF, removing or adding annotations, setting up document metadata, etc.
Open Tools panel and locate Action Wizard tool. Double-click on the tool to open it.
Action Wizard tool
Use New Action... button to create a new processing action. If you already have an action defined, then you can optionally review/edit it by pressing Manage Actions button. Please see online tutorials for details on how to create actions. In this tutorial, we are not going to focus on creating actions.
Create a New Action in Action Wizard tool
Create Batch File
Once you have an action defined, then it is possible to generate a BAT file for running it from a command-line prompt or another application.
Select Plugins > Create Batch File... from the main Acrobat menu. Optionally, check "Create Task Scheduler Compatible BAT File" option if you need run processing in a minimized window and without displaying a progress bar.
IMPORTANT: at this time (July, 2024) new Acrobat interface does not support Action Wizard, you will need to disable new Acrobat and use a "classic" interface. Please see the link below for details.
[⚡ How to locate Plugins menu ⚡].
Select an action from the list and press Create Batch File... button. Specify a BAT filename and save it.
Create Batch File
Now you can execute the corresponding action just by starting the BAT file (by double-clicking on it in the File Explorer window).
Execute Batch File
BAT File Internals
AutoBatch-generated BAT file sets up few environmental variables and starts Adobe Acrobat. The most important variable is AUTOBATCHSEQU. This variable contains a full path to the corresponding Action Wizard “action” file. Action Wizard actions are stored in the files with *.sequ extensions and are essentially XML files containing processing parameters.
SET AUTOBATCHSEQU=C:\Users\info\AppData\Roaming\Adobe\Acrobat\DC\Sequences\Optimize Scanned PDF files and Apply OCR.sequ
SET AUTOBATCHFINAL=0
SET AUTOBATCHDEST=
SET AUTOBATCHALTPATH=%1
SET AUTOBATCHALTOUTPUTPATH=%2
SET AUTOBATCHNOPROGRESS=yes
SET AUTOBATCHFILEEXT=
SET AUTOBATCHNOSUBFOLDERS=no
"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /n /h
AutoBatch Environmental Variables:
AUTOBATCHSEQU

This parameter specifies a full path to the batch sequence file (*.sequ) that needs to be executed. The Adobe Acrobat stores batch sequences (actions) in the files with *.sequ extension. In Adobe Acrobat XI, this file is an XML document. In Acrobat X and previous versions this is a text file that uses a special syntax to store settings ("Cab" file).

AUTOBATCHFINAL

This parameters specifies a final action to execute on input files once the batch job is completed.
List of supported parameters:

  • 0 - no action, leave input files as is.
  • 1 - copy input files to a folder, do not overwrite if files already exist (files are not copied)
  • 2 - move input files to a folder, do not overwrite if files already exist (files are not moved) 
  • 3 - delete input files
  • 4 - rename input files
  • 5 - execute a program or batch files
  • 6 - move files to a different folder, overwrite if files already exist
  • 7 - move files to a different folder, preserve multiple versions if files already exist
  • 8 - copy files to a different folder, preserve multiple versions if files already existexist
  • ,

AUTOBATCHDEST

This parameter is used to pass either a path to a folder or a path to the application to execute depending on the value of AUTOBATCHFINAL parameter.

AUTOBATCHALTPATH

Full path to the alternative input file or folder. The path passed in this parameter overwrites input file parameters selected in the batch sequence (action). By default, this parameter is set to %1. This way a first parameter that is passed to the BAT file will be automatically assigned to this variable. This is the way of passing BAT file parameters to the AutoBatch.

AUTOBATCHALTOUTPUTPATH

Full path to the alternative output folder. Overwrites corresponding parameter selected in the the batch sequence (action). Use this variable to pass a different output folder location. By default this parameter is set to %2. This way a second parameter that is passed to the BAT file will be automatically assigned to this variable. This is the way of passing BAT file parameters to the AutoBatch.

AUTOBATCHNOPROGRESS

Pass "yes" to disable displaying of AutoBatch progress bar. If using Acrobat XI, the application window will be hidden.

AUTOBATCHFILEEXT

This variable provides a way to limit processing to files with specific file extentions. For example, use the following syntax to limit processing only to PDF files:
AUTOBATCHFILEEXT=pdf
Use can specify multiple file extentions using the following syntax:
AUTOBATCHFILEEXT=pdf,doc,txt,jpg
Use AUTOBATCHFILEEXT= to process files of all supported file types. If no file extensions are specified, then all supported file types are converted into PDF and processed by the batch action.

AUTOBATCHNOSUBFOLDERS

Use this parameter to control processing files from subfolders. Use the following syntax to process files from all subfolders for every input folder specified as input to the batch action:
AUTOBATCHNOSUBFOLDERS=no
Use the following syntax to process files located in the input folder only and do not process files from subfolders:
AUTOBATCHNOSUBFOLDERS=yes

Acrobat Command Line Call

The last line in the batch file starts Adobe Acrobat. Pass /h command-line switch to run Acrobat in minimized window. Pass /n to always start a new copy of Adobe Acrobat. These are command line options supported by Adobe Acrobat.

Starting AutoBatch from a C# Application
Here is a sample C# code that shows how to launch AutoBatch from a .NET application and pass all necessary parameters via the environmental variables.
System.Diagnostics.Process firstProc = new System.Diagnostics.Process();
firstProc.StartInfo.FileName = @"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe";
firstProc.EnableRaisingEvents = true;
firstProc.StartInfo.UseShellExecute = false;
firstProc.StartInfo.Arguments = @"/n /h"; // pass command-line parameters
firstProc.StartInfo.EnvironmentVariables.Add("AUTOBATCHSEQU", @"C:\Data\Test.sequ");
firstProc.StartInfo.EnvironmentVariables.Add("AUTOBATCHNOPROGRESS", @"yes");
firstProc.StartInfo.EnvironmentVariables.Add("AUTOBATCHALTPATH", @"C:\Data\Test.pdf");
firstProc.Start();
Passing Input Files
Action Wizard “action” files can contain input file definitions. It can specify either one or more PDF files that need to be processed by the action, or it can specify one or more folders for processing. All files from folders can be processed. Non-PDF files will be converted to PDF prior to processing.
[c:\] myocr.bat “c:\data\pdfs\”
The above batch file will process all files in “c:\data\pdfs” folder instead of “c:\temp” folder that is specified in the original sequence description.
[c:\] myocr.bat “c:\data\pdfs\” "c:\data\processed files"
The above batch file will process all files in “c:\data\pdfs” folder instead of “c:\temp” folder that is specified in the original sequence description and output processed files into "c:\data\processed files" folder.
[c:\] myocr.bat “c:\data\pdfs\fileA.pdf” "c:\data\processed files\documentA.pdf"
The above batch file will process “c:\data\pdfs\fileA.pdf” file and save it as "c:\data\processed files\documentA.pdf". In Acrobat XI, it is possible to pass only output folder, not the output filename.
Click here for a list of all step-by-step tutorials available.