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
The sample code files can be downloaded at the end of the article.
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
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.
|Example file||8.79 KB|