4. Command-line executables

4.1. Java™ version

Four command-line executables are provided: fo2rtf, fo2wml, fo2docx and fo2odt, to convert an XSL-FO file to RTF, WML, Open XML and OpenDocument respectively. The general syntax of a command line is:

fo2rtf [<options>] <input> [<output>]

where <input> is the input XSL-FO file name and <output> the output file name. If no output file is specified the conversion output is written to the standard output stream. Options are specified as:

-<name>=<value>

where <name> is the option name and <value> the option value. Option names and values are described below.

baseURL

Specifies the base URL of relative paths in attribute values (typically the src attribute of the external-graphic element). By default, paths are taken relative to the input source URL.

imageResolution

Specifies the source image resolution in dots per inch. This option value is used to compute the intrinsic size of external-graphic elements, which determines the actual content size when the content-height and content-width attributes are not set to absolute values. The default value is 96.

outputEncoding

Specifies the output encoding. Supported values depend on the target output format:

  • For RTF output supported values are ASCII, Cp1250 (Windows Eastern European), Cp1251 (Windows Cyrillic) and Cp1252 (Windows Latin-1). The default value is Cp1252 (Windows Latin-1).

  • For WML output all encodings available in the current JVM are supported. The option value may be either the encoding name (e.g. ISO8859_1) or the charset name (e.g. ISO-8859-1). The default value is Cp1252 (Windows Latin-1).

  • For Open XML output this option specifies the encoding of XML content in the output document. Supported values are UTF-8 and UTF-16. The default value is UTF-8.

  • For OpenDocument output this option specifies the encoding of XML content (files styles.xml and content.xml) in the output document. All encodings available in the current JVM are supported. The option value may be either the encoding name (e.g. ISO8859_1) or the charset name (e.g. ISO-8859-1). The default value is UTF8.

prescaleImages

Specifies image scaling policy. By default images are prescaled to minimize output document size. If this option is set to false the original size of images is preserved and scaling directives are inserted in the output document.

rtf.target

Specifies the target RTF viewer. Currently the only supported value is MSWord. This option may be needed to circumvent an obscure bug in the RTF loader of MS-Word, which does not handle table cell padding tags correctly. When this option is set to MSWord, XFC will swap top and left padding values in table cells to work around this bug.

singleSidedLayout

Specifies single-sided page layout. By default RTF, WML and Open XML output documents are given a double-sided page layout regardless of the input document properties. This option may be set to true to force a single-sided page layout.

4.2. .NET version

Four command-line executables are provided: fo2rtf, fo2wml, fo2docx and fo2odt, to convert an XSL-FO file to RTF, WML, Open XML and OpenDocument respectively. The general syntax of a command line is:

fo2rtf [<options>] <input> [<output>]

where <input> is the input XSL-FO file name and <output> the output file name. If no output file is specified the conversion output is written to the standard output stream. Available options are described below.

/b <base>

Specifies the base URL of relative paths in attribute values (typically the src attribute of the external-graphic element). By default, paths are taken relative to the input source URL.

/e <encoding>

Specifies the output encoding. Supported values depend on the target output format:

  • For RTF output supported values are us-ascii (ASCII), windows-1252 (Windows Latin-1), windows-1250 (Windows Eastern European) and windows-1251 (Windows Cyrillic). The default value is windows-1252 (Windows Latin-1).

  • For WML and OpenDocument output supported values are us-ascii (ASCII), windows-1252 (Windows Latin-1), windows-1250 (Windows Eastern European), windows-1251 (Windows Cyrillic) and utf-8 (UTF-8). The default value is windows-1252 (Windows Latin-1) for WML output and utf-8 for OpenDocument output.

  • For Open XML output the only supported value is utf-8 (UTF-8).

Note: for Open XML and OpenDocument output this option specifies the encoding of XML content in the output document.

/p

Disables image prescaling. By default images are prescaled to minimize output document size. If this option is specified the original size of images is preserved and scaling directives are inserted in the output document.

/r <resolution>

Specifies the source image resolution in dots per inch. This option value is used to compute the intrinsic size of external-graphic elements, which determines the actual content size when the content-height and content-width attributes are not set to absolute values. The default value is 96.

/s

Specifies single-sided page layout. By default RTF, WML and Open XML output documents are given a double-sided page layout regardless of the input document properties. This option may be used to force a single-sided page layout.

/w

Specifies MS-Word as target RTF viewer. This option may be needed to circumvent an obscure bug in the RTF loader of MS-Word, which does not handle table cell padding tags correctly. When this option is used, XFC will swap top and left padding values in table cells to work around this bug.