The BatchProcessingOptions object controls several aspects concerning the document conversion process itself.
BatchProcessingOptions object is intended for control of automated document conversion process. Its provides access to several conversion options for documents of some types if special processing method is used, controls log file creation and allows you to limit the number of converted pages in output documents. Some properties of BatchProcessingOptions object are intended for cases when it is needed to control abnormal printing application behavior. But normally you don't need to use such properties as Print2Flash Server default settings should handle most of the situations arising during document conversion.
To learn how to use some properties of BatchProcessingOptions object, background information on how Print2Flash converts documents is needed which is presented further. Print2Flash does not convert any types of documents wholly by itself but it instructs the application that can print documents of a given type to send the printing output to the Print2Flash printer where output is intercepted and saved to a Print2Flash document file. First, Print2Flash looks up which application is registered in the operating system for printing of this kind of document. For example, conversion of .doc files is usually handled by Microsoft Word. Then, Print2Flash instructs that application to send the document to the Print2Flash Printer. And finally, Print2Flash Printer gets a printed representation of the document and saves it to a Flash or an HTML5 file.
As conversion is performed with the help of external applications, some problems can arise:
- Application does not start printing regardless of the fact it was instructed to do so
- Application requires some user interaction before printing can be started, e.g. shows a Print dialog window
- Application prints a document too long or hangs up during printing
- Application is not unloaded from memory after printing is completed
It is easy to see that first three problems prevents the document from printing altogether while the last, though allows document conversion, consumes computer memory apparently unnecessarily. By default, Print2Flash handles such situations by itself but if you meet with a problem that seems to be of one of the kinds above, you may use BatchProcessingOptions object's abnormal situation control properties to control document conversion process.
There are three possible scenarios of using BatchProcessingOptions object:
- For specifying special (ad hoc) batch processing options applied to a single conversion or series of conversion. In such a case you should create a BatchProcessingOptions object, setup its properties and pass it to ConvertFile or ConvertDir methods as a BatchProcessingOptions argument;
- For changing default batch processing options applied to all document conversions performed via a single Server object instance. In such a case you should obtain reference to the default batch processing options object using DefaultBatchProcessingOptions property and change its properties. Then you may convert files with this Server object instance and all the options you setup will be applied to all document conversions via this instance;
- For changing global default batch processing options. In such a case you should obtain a reference to the default batch processing options object using DefaultBatchProcessingOptions property, change its properties and save the changes using ApplyChanges method.
To create an ad hoc BatchProcessingOptions object, you need to create it using "Print2Flash5.BatchProcessingOptions" ProgID such as in the following example:
Here P2F refers to Server object instance.
Regardless of the method you obtained a BatchProcessingOptions object, initially it contains the global default batch processing options setup by Print2Flash installation or by the last ApplyChanges method call. After you obtained a reference to BatchProcessingOptions object using one of the methods above, you can access its properties and methods.
|CreateLogFile||Boolean||Indicates whether to create a conversion log file which name is specified by LogFileName property|
|LogFileName||String||The name of the conversion log file|
|LoggingLevel||Integer||Specifies which messages are
written to the log file specified by LogFileName
Special document processing
|UseAutomation||Integer||Bit mask which specifies for which document types special document processing should be used. The mask must be an OR combination of flags from APPLICATIONTYPE enumeration.|
|ExcelOptions||ExcelOptions object||Contains special Excel processing options used for conversion of Excel documents if special processing for Microsoft Excel is turned on.|
|PowerPointOptions||PowerPointOptions object||Contains special PowerPoint processing options used for conversion of PowerPoint documents if special processing for Microsoft PowerPoint is turned on.|
|KeepAutomationAppRef||Integer||This property specifies if the same application instance should be reused for printing of successive documents of the same type. Such reusing prevents closing of the respective application after conversion and uses existing application instance from previous conversion for processing of the next document of the same type. This could save conversion time because application does not have to exit and be loaded for each document conversion. If this flag is turned on for the given application, the application is closed only after the Server object is destroyed. This option works only if special document processing is turned on. The value is an OR combination of flags from APPLICATIONTYPE enumeration.|
|KillAllAutomationProcesses||Integer||Specifies if all processes of the given application should be killed if AfterPrintingTimeout expires after document printing is completed. Use this option with care as it kills all instances of the given application regardless of whether an instance actually took part in document conversion or not. For example, after conversion of a Word document, this option kills all Word processes (winword.exe). This option may be useful for ensuring full cleanup after document conversion is done as sometimes applications do not properly exit after printing or it is impossible to determine an actual instance that performed printing and thus KillProcessIfTimeout property cannot work. This option works only if special document processing is turned on. The value is an OR combination of flags from APPLICATIONTYPE enumeration.|
|CheckPDFEncryption||Integer||This property makes Print2Flash
check if a PDF document is encrypted before conversion and return a
respective error message if it is. It should have a value from
ThreeStateFlag enumeration. If
the value is:
|ActivityTimeout||Integer||Maximum time in milliseconds Print2Flash waits for the application to invoke the next Print2Flash Printer driver function while printing. This option may be useful for detection of printing application hang-ups. If an application does not show activity within this timeout (i.e. does not call the next driver function), Print2Flash proceeds to the next document, and, if KillProcessIfTimeout is true, the application process is killed as well. Zero (0) value means this timeout is not monitored.|
|AfterPrintingTimeout||Integer||Maximum time in milliseconds Print2Flash waits for the application to exit after document printing is completed. If this time expires, Print2Flash proceeds to the next document, and, if KillProcessIfTimeout is true, the application process is killed as well. Zero (0) value means this timeout is not monitored|
|BeforePrintingTimeout||Integer||Maximum time in milliseconds Print2Flash waits for the application to start document printing. If this time expires, Print2Flash proceeds to the next document, and, if KillProcessIfTimeout is true, the application process is killed as well. Zero (0) value means this timeout is not monitored|
|KillProcessIfTimeout||Integer||Should have a value from ThreeStateFlag enumeration. If the value is:|
|KillSplWOW64||Integer||This property is used only for
64 bit edition of Print2Flash. It specifies whether the Windows printer
driver host process (splwow64.exe) should be killed after an error occurred
at conversion. If your conversion server processes only Print2Flash printing
jobs, it is recommended to set this value to TSF_YES for possible reset of
error condition. However, if your server processes print jobs for other
printers, killing of printer driver host process may disrupt printing
on other printers, and the recommended value is TSF_NO. The value should be from
ThreeStateFlag enumeration. If
the value is:
|PressPrintButton||Integer||Should have a value from
ThreeStateFlag enumeration. If value is:
|PrintingTimeout||Integer||Maximum time in milliseconds Print2Flash waits for the application to print the document. If this time expires, Print2Flash cancels the print job and proceeds to the next document, and, if KillProcessIfTimeout is true, the application process is killed as well. Zero (0) value means this timeout is not monitored|
|PageRange||String||String describing which pages
to include in the output Print2Flash document. Pages that do not fit the specified
range are skipped at printing. The string should be in the following format:
[Range1Start[-][Range1End]] [,Range2Start[-][Range2End]] [, ... ]
This string is composed of a sequence of page ranges separated by commas. Each page range can be either a plain page number such as "3", a page range such as "2-7" or an open page range such as "20-".
For example, string "2-7, 11, 20-" instructs to print pages from 2 to 7, page 11 and pages from page 20 to the end of the document. Page 1, pages from 8 to 10 and from 12 to 19 are skipped and not included in the output document.
Empty string value makes Print2Flash print all the document pages.
|GenerateExternalViewer||Boolean||This property makes sense only for HTML5 documents and for Flash documents in External Viewer output format. It specifies whether an external viewer file should be created in the output folder. For Flash documents the viewer file name is docviewer.swf. For HTML5 documents the viewer file name is docviewer.html. See Output Formats for more information.|
Method saves the global default batch processing options.
Method takes the object properties and saves them as the global default batch processing options. If you intend to change the global default batch processing options, you need to call this method to save the changes.
The following example obtains a default batch processing options object, modifies some of its properties and save the changes back to the global default batch processing options. The example assumes that enumeration constants file P2FAPIConst.vb from Print2Flash SDK is included:
Set DefBPOpt=P2F.DefaultBatchProcessingOptions DefBPOpt.BeforePrintingTimeout = 60000 DefBPOpt.PrintingTimeout = 10000 DefBPOpt.PressPrintButton = TSF_AUTO DefBPOpt.KillProcessIfTimeout = TSF_YES DefBPOpt.ApplyChanges
BatchProcessingOptions Object Examples
The sample below creates an ad hoc batch processing options object, sets its properties and use it for conversion of a document named C:\Docs\index.htm
set MyBPOpt=CreateObject("Print2Flash5.BatchProcessingOptions") MyBPOpt.PressPrintButton = TSF_YES P2F.ConvertFile "C:\Docs\index.htm", , , MyBPOpt
Set DefBPOpt=P2F.DefaultBatchProcessingOptions DefBPOpt.AfterPrintingTimeout = 5000 DefBPOpt.CreateLogFile = True DefBPOpt.LogFileName = "C:\Logs\Print2FlashConv.log" P2F.ConvertDir "C:\Docs" P2F.ConvertDir "C:\ReadyDocuments"