Help Contents

Enhanced Batch Processing

Overview

Enhanced Batch Processing lets you convert documents to HTML5 format programmatically without user assistance using operating system command line. Enhanced Batch Processing is available only in Server mode. Another option for automatic document conversion in Server mode is Print2HTML5 OLE Automation API.

Command Line Syntax

Enhanced Batch Processing is activated when launching Print2HTML5 Server application from operating system command line with parameters. The command line syntax is as follows:

p2hserver.exe sourcefilename [outputfilename] [options]

OR

p2hserver.exe sourcefiledir[\filemask] [outputdirname] [options]

The first syntax option is used for conversion of a single file while the second - for conversion of multiple files in a directory. You may need to specify full path to the p2hserver.exe which is a Print2HTML5 Server executable and is located in the same directory where Print2HTML5 is installed, e.g. "C:\Program Files\Print2HTML5". This path is chosen at Print2HTML5 setup on the Choose Destination Location screen.

There are following parameters:

  • sourcefilename - the name of the document to convert. For example, to convert a document named c:\MyDoc.doc use "c:\MyDoc.doc" as this parameter value;
  • outputfilename - specifies the base output filename without extension. Print2HTML5 adds .xml extension to this name. If this parameter is omitted, the file is put into the same folder as the original file, and HTML5 documents are named after the original document with .xml extension appended to the original document name;
  • sourcefiledir - the name of the directory where the documents to convert reside;
  • filemask - the mask for the files to convert, e.g. "*.doc". If this argument is not specified, all files are attempted to convert. For example, to convert all Microsoft Word (with .doc extension) documents use "*.doc" value;
  • outputdirname - specifies the output folder to which all converted documents will be written. The output HTML5 documents are named after the original document with .xml extension appended to the original document name. For example, if a file was named MyDoc.doc, the converted HTML5 document will be named MyDoc.doc.xml.

If any file name or path parameters contain spaces, they must be enclosed in double quotes. In options parameter you can list one or more options. Most options corresponds to the properties and methods of Print2HTML5 OLE Automation API objects. The general syntax of an option is:

/OptionName:OptionValue

Here OptionName is the name of the option from the table below, and OptionValue specifies the option value and must be of the type specified in the table.  For example, to specify German document interface language, you need to specify this option:

/Language:de

The available options are listed in the table below.

Option name Value type Description

Document interface

InterfaceOptions Integer Similar to InterfaceOptions property of Profile object.
Language String Similar to Language property of Profile object.

Skins

SkinName String The name of the predefined skin to use. If other skin parameters listed below are specified, they override this skin settings. If this parameter is omitted, the default Skin object settings are used.
ToolbarBgrColor Integer Similar to ToolbarBgrColor property of Skin object.
OverButColor Integer Similar to OverButColor property of Skin object.
OverRectColor Integer Similar to OverRectColor property of Skin object.
DownButColor Integer Similar to DownButColor property of Skin object.
DownRectColor Integer Similar to DownRectColor property of Skin object.
DocBgrColor Integer Similar to DocBgrColor property of Skin object.
TextHighlightColor Integer Similar to TextHighlightColor property of Skin object.
ZoomHandleOffset Integer Similar to ZoomHandleOffset property of Skin object.
LogoURL String Similar to LogoURL property of Skin object.
HelpButtonURL String Similar to HelpButtonURL property of Skin object.
TBBgrImgBehavior Integer Similar to TBBgrImgBehavior property of Skin object.
TBImage<Integer> String Specifies an image file name to use for a toolbar button or control. The image to be set is specified as a number at the end of the parameter name. This number must be one of the values of TOOLBARIMAGE enumeration. For example, parameter name TBImage10 corresponds to the Next Page button image. This parameter accomplishes a similar function as SetToolbarImage method of the Skin object.
NoSkin Boolean When this option is "on", it tells Print2HTML5 that no skin is used and no skin images are stored inside the document. It is helpful for reducing of document file size in case you either don't need the document toolbar at all or use your own custom document viewer for single file mode. When this option is "on", it cancels using of the default skin and overrides the SkinName and TBImage parameters. Can be "on" or 'off".

Document protection

ProtectionOptions Integer Similar to ProtectionOptions property of Profile object.
RestrictionDomains String Similar to RestrictionDomains property of Profile object.

Options for HTML5 documents

HTML5Options.
Compatibility
Integer Similar to Compatibility property of HTML5Options object.
HTML5Options.
Compression
Boolean Similar to Compression property of HTML5Options object. Can be either "on" or "off".
HTML5Options.
DocTemplate
String Similar to DocTemplate property of HTML5Options object.
HTML5Options.
SinglePageModeThreshold
Integer Similar to SinglePageModeThreshold property of HTML5Options object.
HTML5Options.SubsetFonts Boolean Similar to SubsetFonts property of HTML5Options object.
HTML5Options.VersionIE String Similar to VersionIE property of HTML5Options object.
HTML5Options.
VersionFirefox
String Similar to VersionFirefox property of HTML5Options object.
HTML5Options.
VersionChrome
String Similar to VersionChrome property of HTML5Options object.
HTML5Options.
VersionOpera
String Similar to VersionOpera property of HTML5Options object.
HTML5Options.
VersionSafari
String Similar to VersionSafari property of HTML5Options object.
HTML5Options.ViewMode Integer Similar to ViewMode property of HTML5Options object.

Document optimization

UseJpeg Boolean Similar to UseJpeg property of Profile object. Can be either "on" or "off".
JpegQuality Integer Similar to JpegQuality property of Profile object. If specified, it is implied that UseJpeg option is on.

Hyperlinks

ParseLinks Boolean Similar to ParseLinks property of Profile object. Can be either "on" or "off".
ExtractLinks Integer Similar to ExtractLinks property of Profile object.
LinkTargetAuto Boolean Similar to LinkTargetAuto property of Profile object. Can be either "on" or "off".
LinkTarget Integer Similar to LinkTarget property of Profile object.

Watermarks

WatermarkImage String Similar to WatermarkImage property of Profile object.
WatermarkScale Integer Similar to WatermarkScale property of Profile object.
WatermarkTransparency Integer Similar to WatermarkTransparency property of Profile object.
WatermarkAnchor String Similar to WatermarkAnchor property of Profile object.
WatermarkXOffset Integer Similar to WatermarkXOffset property of Profile object.
WatermarkYOffset Integer Similar to WatermarkYOffset property of Profile object.

Page thumbnails

ThumbnailPageRange String Similar to ThumbnailPageRange property of Profile object.
ThumbnailFileName String Similar to ThumbnailFileName property of Profile object.
ThumbnailFormat Integer Similar to ThumbnailFormat property of Profile object.
ThumbnailImageHeight Integer Similar to ThumbnailImageHeight property of Profile object.
ThumbnailImageWidth Integer Similar to ThumbnailImageWidth property of Profile object.

Metadata file

CreateMetaDataFile Boolean Similar to CreateMetaDataFile property of Profile object. Can be either "on" or "off".
MetaDataFileFormat Integer Similar to MetaDataFileFormat property of Profile object.
MetaDataFileName String Similar to MetaDataFileName property of Profile object.

Log file

CreateLogFile Boolean Similar to CreateLogFile property of BatchProcessingOptions object. Can be either "on" or "off". Default is "off";
LogFileName String Similar to LogFileName property of BatchProcessingOptions object. If this option is specified, it implies that CreateLogFile option is also specified. By default, the log is written to p2hServer.exe.log file located in the same directory where Print2HTML5 is installed.
LoggingLevel Integer Similar to LoggingLevel property of BatchProcessingOptions object. Default value is 0.

Special document processing

UseAutomation Integer Similar to UseAutomation property of BatchProcessingOptions object.
KillAllAutomationProcesses Integer Similar to KillAllAutomationProcesses property of BatchProcessingOptions object.
Excel.SheetRange String Similar to SheetRange property of ExcelOptions object.
Excel.OverridePrintQuality Boolean Similar to OverridePrintQuality property of ExcelOptions object. Can be either "on" or "off".
PowerPoint.FitToPage Boolean Similar to FitToPage property of PowerPointOptions object. Can be either "on" or "off".
PowerPoint.FrameSlides Boolean Similar to FrameSlides property of PowerPointOptions object. Can be either "on" or "off".
PowerPoint.OutputType Integer Similar to OutputType property of PowerPointOptions object.
PowerPoint.
PrintHiddenSlides
Integer Similar to PrintHiddenSlides property of PowerPointOptions object. Can be either "on" or "off".
CheckPDFEncryption Integer Similar to CheckPDFEncryption property of BatchProcessingOptions object.

Printing preferences

FormName String Similar to SetFormName method of PrintingPreferences object.
Orientation Integer Similar to Orientation property method of PrintingPreferences object.
PaperLength Integer PaperLength and PaperWidth can be specified to denote a custom paper size similar to SetCustomPaperSize method of PrintingPreferences object.
PaperWidth Integer See PaperLength option above.
Resolution Integer Similar to Resolution property of PrintingPreferences object.

Abnormal situation control

ActivityTimeout Integer Similar to ActivityTimeout property of BatchProcessingOptions object.
AfterPrintingTimeout Integer Similar to AfterPrintingTimeout property of BatchProcessingOptions object. Default is 10 seconds.
BeforePrintingTimeout Integer Similar to BeforePrintingTimeout property of BatchProcessingOptions object. Default is 30 seconds.
KillProcessIfTimeout Boolean Similar to KillProcessIfTimeout property of BatchProcessingOptions object. Can be either "on" or "off". If omitted, Print2HTML5 determines the best value for this setting automatically.
KillSplWOW64 Boolean Similar to KillSplWOW64 property of BatchProcessingOptions object. Can be either "on" or "off". If omitted, Print2HTML5 determines the best value for this setting automatically.
PressPrintButton Boolean Similar to PressPrintButton property of BatchProcessingOptions object. Can be either "on" or "off". If omitted, Print2HTML5 determines the best value for this setting automatically.
PrintingTimeout Integer Similar to PrintingTimeout property of BatchProcessingOptions object. Default is infinite time.

Other options

IncludeSubDirs Boolean Boolean indicator specifying whether to look for files to convert in all subdirectories of the sourcefiledir directory in addition to the files located directly in sourcefiledir directory. This option can only be used for directory conversion. Can be either "on" or "off". By default it is "off".
PageRange String Similar to PageRange property of BatchProcessingOptions object.


Using Enhanced Batch Processing

To launch Print2HTML5 in batch mode, click Start button in Windows and select Run. In the opened dialog window type the command line according to the syntax and click OK.

Then Print2HTML5 is launched in the background (without user interface) and starts converting specified documents. After a document is converted, the output Print2HTML5 document file is created in the specified output folder. Note that though Print2HTML5 is launched without user interface in batch processing mode, the applications which send documents to Print2HTML5 may display user interface.

If you feel that there is a problem with document conversion, use /LogFileName option to create a log file. It lists all important events occurred at conversion including successful conversions and errors and should help you in diagnosing the cause of the problem.

Examples

  1. The following example converts a document named "C:\MyDocs\Report.xls" to HTML5 document named "C:\MyDocs\Report.xls.xml" and enables only Drag, Select Text, Previous Page and Next Page buttons in the resulting document:

  2. p2hserver.exe C:\MyDocs\Report.xls /InterfaceOptions:646

    The InterfaceOptions argument is obtained by addition of the respective constants from INTERFACE_OPTION enumeration: 2+4+128+512=646
     
  3. The next example converts all documents in a directory named "C:\MyDocs" to Print2HTML5 documents written into "C:\HTMLDocs" directory and disables printing and copying text in the documents:
     
    p2hserver.exe C:\MyDocs C:\HTMLDocs /ProtectionOptions:3

    The ProtectionOptions argument is obtained by addition of the respective constants from PROTECTION_OPTION enumeration: 1+2=3.
     
  4. The example below converts a document named "C:\MyDocs\Conference.txt"  to HTML5 document named "D:\Publish\Report2.xml" selecting Landscape page orientation and Letter paper size for output file pages:
     
    p2hserver.exe C:\MyDocs\Conference.txt D:\Publish\Report2 /FormName:Letter /Orientation:2 

    The orientation value is taken from PAPER_ORIENTATION enumeration.