Chapter 3. Command-line executables

[Important]About Evaluation Edition

Do not be surprised because XMLmind XSL-FO Converter Evaluation Edition generates output containing random duplicate letters. Of course, this does not happen with Professional Edition!

Four command-line executables are provided: fo2rtf, fo2wml, fo2docx and fo2odt, to convert an XSL-FO file to RTF, WML, Open XML (.docx) and OpenDocument (.odt) 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.

Commonly used options:
outputFormat

Format of the output file: rtf, wml, docx or odt. Default: rtf. Note that command-line utility fo2wml automatically sets outputFormat to wml, fo2docx automatically sets outputFormat to docx and fo2odt automatically sets outputFormat to odt.

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 (.docx), 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 (.odt), 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.

imageResolution

Default image resolution in DPI. A positive integer. Used to compute the intrinsic size of an image, but only when an image file does not contain resolution or absolute size information.

Default value: 96.

prescaleImages

Image scaling policy. true or false. Default: false.

Specify prescaleImages=true to minimize output document size. By default (prescaleImages=false), the original size of images is preserved and scaling directives are inserted in the output document.

Note that:

  • Property prescaleImages=true will never create an image which has larger dimensions than the original image. It can only create an image which has smaller dimensions than the original image.

  • Property prescaleImages=true is honored only for true raster graphics. Vector graphics (WMF, EMF) are never prescaled. Pre-rasterized vector graphics (SVG, MathML) are always prescaled (by the competent renderer, e.g. Batik or JEuclid, not by XMLmind XSL-FO Converter itself).

genericFontFamilies

May be used to map the generic font families serif, sans-serif, monospace, fantasy and cursive to actual font families.

Syntax:

map -> entry [',' entry]*

entry -> generic_family '=' actual_family

generic_family -> 'serif' | 'sans-serif' | 'monospace'
                  | 'cursive' | 'fantasy'

Example: "-genericFontFamilies=fantasy=Impact,cursive=Comic Sans MS".

The default mapping depends on the output format: the generic font families serif, sans-serif, monospace are mapped to "Times New Roman", Arial, "Courier New" for RTF, WML and Open XML (.docx) and to "DejaVu Serif", "DejaVu Sans", "DejaVu Sans Mono" for OpenDocument (.odt).

Note that by default, generic font families fantasy and cursive are not mapped.

set.graphic_factory_name.parameter_name

Sets parameter parameter_name on graphic factory called graphic_factory_name (case-insensitive). A graphic factory is a software component in charge of processing one or more graphic formats. Examples of such graphic factories: ImageIO, WMF, EMF, SVG, MathML. Only few graphic factories may be parameterized this way.

Table 3.1. Graphic factory parameters
graphic_factory_nameparameter_nameValueDefaultDescription
SVGresolutionDPI, positive integer192Resolution used to convert SVG vector graphics to PNG raster images.
MathMLresolutionDPI, positive integer288Resolution used to convert MathML equations (may be seen as vector graphics) to PNG raster images.
mathsizept, positive integer12The base font size of MathML equations.

Examples:

-set.svg.resolution=300
-set.MathML.mathsize=11
-set.mathml.resolution=300
singleSidedLayout

Specifies single-sided page layout. By default RTF, WML and Open XML (.docx) 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.

styles

Specifies the location of an XML file containing the set of user styles to be used during the conversion. More information about user styles in Chapter 6, XSL-FO extension for generating named styles.

This location is an URL in its string form (e.g. "file:///C:/My%20Folder/styles.xfc") or a filename (e.g. "C:\My Folder\styles.xfc"). A relative filename is relative to the current working directory.

The XML file must conform to the styles.xsd schema.

By default, XMLmind XSL-FO Converter generates only direct formatting (RTF, WordprocessingML, .docx) or automatic styles (.odt).

Rarely used options:
eastAsiaFontFamilies

May be used to map East Asian font families to Western font families. Such East Asian fonts are used to render mainly CJK (Chinese Japanese Korean) text, possibly mixed with Western text. More information in Section 4.10, “Special support for East Asian fonts”.

Syntax:

map -> entry [',' entry]*

entry -> east_asian_family '=' western_family

Example: "-eastAsiaFontFamilies=MS UI Gothic=Times New Roman,Meiryo=Calibri".

For compatibility with previous versions of XMLmind XSL-FO Converter, the default value of this property is "Arial Unicode MS=Arial".

[Important]

This property is supported by the ODT, WML and DOCX output formats, but not by the RTF output format.

imageRendererResolution

Default image resolution in DPI. A positive integer. Used to compute the intrinsic size of an image, according to the image renderer (that is, MS-Word or OpenOffice), when an image file does not contain resolution or absolute size information.

The default value depends on the output format. Generally 96. It is strongly recommended to use this default value.

screenResolution

Screen resolution in DPI. A positive integer. Used to convert px lengths to other units (in, mm, cm, pt, etc).

Default value: 96.

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.

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.

docx.useVML

Boolean (false or true) specifying whether images contained in Office Open XML (.docx) files should be represented using the deprecated VML markup rather than the DrawingML markup.

Default: false.

docx.variant

Value: MS-Word_major_version [ strict ]?. Examples: 14, 15, 15strict.

Marks generated DOCX files as being compatible with MS-Word having specified major version. Any major version other than 14 (MS-Word 2010), 15 (MS-Word 2013), 16 (MS-Word 2016) is currently ignored.

Moreover suffix "strict" (supported only when MS-Word_major_version >= 15) may be used to generate DOCX files marked as being "Strict Open XML".

Default: None. The generated DOCX files are not marked as being compatible with a specific version of MS-Word.

[Tip]

Specifying -docx.variant=15 suppresses the "[Compatibility Mode]" text appearing in the title bar of MS-Word 2013 and 2016.

[Note]

Specifying -docx.variant=15 does not prevent the generated DOCX file from being opened in MS-Word 2007 and 2010. However specifying -docx.variant=15strict generates "Strict Open XML" files which are not supported by MS-Word 2007 and 2010.

alwaysSaveAsPNG

Specifies whether input JPEG and SVG graphics should be converted to PNG in the output file.

ValueDefinition
falseDo not convert input JPEG and SVG graphics to PNG in the output file. Default value for the ODT output format.
trueConvert input JPEG and SVG graphics to PNG in the output file.
jpegConvert input JPEG graphics (not SVG graphics) to PNG in the output file.
svgConvert input SVG graphics (not JPEG graphics) to PNG in the output file. Default value for the RTF, WML and DOCX output formats, which anyway cannot contain SVG graphics.
detectLists

true or false. Default: true. If false, do not attempt to create proper lists by inferring the numbering style of the list from the label of its first item. (By default, XFC attempts to create proper lists by inferring he numbering style of the list from the label of its first item.)

Note that even when -detectLists=false is used, it's still possible to instruct XFC to create proper lists by specifying extension attribute xfc:label-format in the XSL-FO input file.

meta.metadata_name

Specifies a metadata to be added to the document information section of the generated document. More information in Section 4.7, “Adding metadata to the documents created by XFC.

Examples: "-meta.lastModifiedBy=john@acme.com", "-meta.xfc:final=true".

protection

Specifies how the generated document is to be restricted in terms of editing and/or formatting. Restrictions syntax is:

'unrestricted' | 'limited-formatting' |
('read-only'|'comments-only'|'fill-forms-only'|'tracked-changes-only' 
 [ '+limited-formatting' ]?)

Examples: "-protection=comments-only", "-protection=limited-formatting", "-protection=tracked-changes-only+limited-formatting".

Use "" or "unrestricted" to discard any existing edit restriction. More information in Section 4.8, “Restricting editing in the documents created by XFC.

unprotectPassword

This clear text password lets the user of the word processor remove the edit restrictions. By default, the document protection is not enforced using a password.

Use "" to discard any existing password. More information in Section 4.8, “Restricting editing in the documents created by XFC.