Chapter 10. downCast Commandline Interface

1. Reference
2. Example
3. Commandfile syntax

Important

Using the Commandline Interface to downCast requires a license that includes the API feature.

The downCast commandline interface essentially is the downCast API wrapped by a commandline-interpreting class and delivered as part of the downcast.jar. This is also the reason why a license including the API feature is required to use the commandline interface.

1. Reference

To access downCast via the commandline interface, start downCast as follows:

java -cp downcast.jar de.infinityloop.downcast.DowncastCmdline options...

Available options are:

-debug true | false

Turns writing debug info into the log file on or off.

-license licensefile

Specifies license file to use (absolute, local file system path). This license must include the API feature.

-addencoding encodingfile

Adds the specified custom encoding file to the set of known encodings (absolute, local file system path).

-setfontconfiguration stdfontsconfig

Specifies a custom font configuration to be used (absolute, local file system path).

-addcatalog catalog

Adds the specified catalog file (absolute, local file system path) to the set of known catalogs.

-param param-name param-value

Sets a parameter value to be passed/defined in a commandfile.

-commandfile name

The name of a commandfile, which contains commands as listed here one per line. This is more convenient to write (since you can distribute options over several lines) and a necessity if on your system, the length of the commandline is limited to a certain number of characters.

The commandfile format is described here.

-downcastengine name

Specifies the user identification for this running instance of downCast (visible in log files).

-setglobalparameter param-name param-value

Specifies a global downCast parameter.

-convertfile filename

Specifies the source file for the conversion, i.e. the document to be processed. This must be an absolute path to a local file.

-preprocess srcfilename destfilename

Lets you just preprocess the source file using XSLT and write the result to a file. For this to work, you need to set the following global properties beforehand: XSLTProcessor and PreprocessingSheet. Optionally, you may pass parameters to the XSLT by setting the global parameter XSLTParameters, which should follow the pattern [name '=' '"' value '"']? [ '[;,]' name '=' '"' value '"' ]* .

Important

The sequence of options is significant! Consider each of them directly resulting in the internal corresponding action as when you were to perform it programmatically via the API.

2. Example

java -cp downcast.jar de.infinityloop.downcast.DowncastCmdline \
-debug true \
-license "C:\Documents and Settings\il\downcast.license" \
-downcastengine "CmdLine" \
-setglobalparameter outputDir "C:\Documents and Settings\il\output" \
-convertfile "C:\Documents and Settings\il\test.xml"

This calls the commandline interface and converts the document C:\Documents and Settings\il\test.xml to C:\Documents and Settings\il\output\test.rtf.

3. Commandfile syntax

A commandfile is a plain text file consisting of one complete option (incl. parameters) per line. Commands can be indented for better legibility. Lines starting with a semicolon are considered comments. Parameter values defined on the commandline via the -param option can be referenced using the downCast default variable referencing syntax ${paramname}.

An example says more than 100 words - a look at the following sample commandfile will make everything clear:

Example 10.1. CLI Commandfile example

This converts a single document to RTF. The name of the sourcefile is passed by way of the -param option to the commandfile as variable.

The call would look like this (in one line):

java -cp downcast.jar de.infinityloop.downcast.DowncastCmdline -param destpath "/cli/out/" -param infile "/cli/in/test.xml" -commandfile "/cli/commands.txt"

commands.txt would then have contents similar to the following:

; For debugging output, set the following to true
-debug false
; Set license
-license "/cli/downcast.license"
; Create downCast Engine
-downcastengine MyEngine;
; Where should the results go?
-setglobalparameter outputDir ${destpath}
;
; Set some other conversion parameters
; Post-conversion to .doc binary format:
-setglobalparameter ConvertToDoc "true"
; set to false if you want to keep temporary files:
-setglobalparameter DeleteTemporaryFile "true"
;
; Finally: Convert!
-convertfile ${infile}