The Batch Printing example shows you how to control the printer when printing
multiple documents. Based on feedback from users of the printer I have created
an example that will pick up a document in one folder and create a PDF file from
that document in another folder. It is a common pitfall to launch multiple
print jobs simultaneously. This is not supported by the printer. When a runonce
configuration is made for the printer, we have to wait until that configuration
is processed before we make the next one. A runonce file is removed by the
printer when it is read.
A logical flow of the example is described below.
for each document in the input folder
create a runonce file with the settings for the print job
start the print job
wait until the printer removes the runonce settings file
Example source files are included in the zip file that can be downloaded here.
Example Source Files
In case you want to try this example on a larger number files you can modify the
create_documents.vbs script and run it. This script will create a number of
input files for testing the functionality and robustness of the example.
There are other ways to determine when a print job is finished. In this example
we wait until the runonce settings file is removed by the printer.
Alternatively, you can use the RunOnSuccess, RunOnError, and AfterPrintProgram
settings to hook into the printing process. Waiting for the output of the print
job is not very robust since there will be no output in case of an error.