xmlgraphics-fop — Formatter for Printing XSLT Processed XML Files
Classname: org.apache.fop.cli.Main
xmlgraphics-fop [ -fo | -xml ] infile [ -xsl file ] [ -awt | -pdf | -mif | -rtf | -tiff | -png | -pcl | -ps | -txt | -at [mime] | -print ] outfile
The following options in alphabetical order are available:
-aenables accessibility features (Tagged PDF etc., default off)
-afp OUTFILEinput will be rendered as AFP
-at [mime] OUTFILErepresentation of area tree as XML specify optional mime output to allow the AT to be converted to final format later
-atin
INFILEarea tree input file
-awtinput will be displayed on screen
-c
cfg.xmluse additional configuration file
cfg.xml
-cataloguse XML catalog resolver for input XML and XSLT files
-conserveenable memory-conservation policy (trades memory-consumption for disk I/O) (Note: currently only influences whether the area tree is serialized.)
-ddebug mode
-dpi
XXXtarget resolution in dots per inch (dpi) where
XXX is a number
-fo
INFILEXSL-FO input file
-foout OUTFILEinput will only be XSL transformed. The intermediate
XSL-FO file is saved and no rendering is performed. (Only
available if you use -xml and
-xsl parameters)
-if [mime] OUTFILErepresentation of document in intermediate format XML specify optional mime output to allow the IF to be converted to final format later
-ifin
INFILEintermediate format input file
-imagein
INFILEimage input file (piping through stdin not supported)
infileXSL-FO input file (use - for infile to
pipe input from stdin); same as -fo
-l LANGuse the language for user information
-noannotationsencrypt PDF file without edit annotation permission
-nocopyencrypt PDF file without copy content permission
-noeditencrypt PDF file without edit content permission
-noprintencrypt PDF file without printing permission
-o
PASSWORDencrypt PDF file with option owner password
-out mime OUTFILEinput will be rendered using the given MIME type.
Example: -out application/pdf D:\out.pdf
(Tip: -out list prints the list of
supported MIME types)
outfileinput will be rendered as PDF into outfile (use
- for outfile to pipe output to
stdout)
-param NAME
VALUE
NAME to use for parameter
NAME in XSLT stylesheet (repeat
this option for each parameter)
-pcl OUTFILEinput will be rendered as PCL
-pdf
OUTFILEinput will be rendered as PDF (outfile required)
-pdfa1b
OUTFILEinput will be rendered as PDF/A-1b compliant PDF
(outfile required, same as -pdf outfile
-pdfprofile PDF/A-1b)
-pdfprofile
PROFPDF file will be generated with the specified profile
(Examples for PROF: PDF/A-1b or
PDF/X-3:2003)
-png OUTFILEinput will be rendered as PNG
-printinput file will be rendered and sent to the printer
see options with -print help
-ps OUTFILEinput will be rendered as PostScript
-qquiet mode
-rrelaxed/less strict validation (where available)
-rtf OUTFILEinput will be rendered as RTF
-sfor area tree XML, down to block areas only
-svg OUTFILEinput will be rendered as an SVG slides file.
Experimental feature; requires additional
fop-sandbox.jar
-tiff OUTFILEinput will be rendered as TIFF
-txt OUTFILEinput will be rendered as plain text
-u
PASSWORDencrypt PDF file with option user password
-vrun in verbose mode (currently simply print FOP version and continue)
-versionprint FOP version and exit
-xdump configuration settings
-xml
INFILEXML input file, must be used together with
-xsl
-xsl
STYLESHEETXSLT stylesheet
This is a small overview. More details can be found in http://xmlgraphics.apache.org/fop/trunk/configuration.html#renderers.
Example 1. Excerpt FOP Configuration File
<fop version="1.0">
<!-- Strict user configuration -->
<strict-configuration>true</strict-configuration>
<!-- Strict FO validation -->
<strict-validation>true</strict-validation>
<!-- Base URL for resolving relative URLs -->
<base>./</base>
<!-- Font Base URL for resolving relative font URLs -->
<font-base>./</font-base>
<!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
<source-resolution>72</source-resolution>
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
<target-resolution>72</target-resolution>
<!-- default page-height and page-width, in case
value is specified as auto -->
<default-page-settings height="11in" width="8.26in"/>
<!-- Use file name nl_Bel instead of the default nl_BE -->
<hyphenation-pattern lang="nl" country="BE">nl_Bel</hyphenation-pattern>
<!-- etc. etc..... -->
</fop>Table 1. Summary of the General Configuration Options
| Element | Data Type | Description | Default Value |
|---|---|---|---|
base | URL or directory | Specifies the base URL based on which relative URL will be resolved | current directory |
font-base | URL or directory | Specifies the base URL based on which relative font URLs will be resolved | base URL/directory |
hyphenation-base | URL or directory | Specifies the base URL based on which relative URLs to hyphenation pattern files will be resolved. If not specified, support for user-supplied hyphenation patterns remains disabled | disabled |
Relative URIs for the above three properties are evaluated relative to the base URI of the configuration file. If the configuration is provided programmatically, the base URI can be set with FopFactory.setUserConfigBaseURI; default is the current working directory. | |||
hyphenation-pattern | String, attribute lang, attribute country (optional) | Register a file name for the hyphenation pattern for the mentioned language and country. Language ll and country CC must both consist of two letters. | ll_CC |
source-resolution | Integer | Resolution in dpi (dots per inch) which is used internally to determine the pixel size for SVG images and bitmap images without resolution information. | 72dpi |
target-resolution | Integer | Resolution in dpi (dots per inch) used to specify the output resolution for bitmap images generated by bitmap renderers (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter effects and such. | 72dpi |
strict-configuration | Boolean | Setting this option to 'true' will cause FOP to strictly verify the contents of the FOP configuration file to ensure that defined resources (such as fonts and base URLs/directories) are valid and available to FOP. Any errors found will cause FOP to immediately raise an exception. | false |
strict-validation | Boolean | Setting this option to 'false' causes FOP to be more forgiving about XSL-FO validity, for example, you're allowed to specify a border on a region-body which is supported by some FO implementations but is non-standard. Note that such a border would currently have no effect in Apache FOP. | true |
break-indent-inheritance | Boolean | Setting this option to 'true' causes FOP to use an alternative rule set to determine text indents specified through margins, start-indent and end-indent. Many commercial FO implementations have chosen to break the XSL specification in this aspect. This option tries to mimic their behaviour. Please note that Apache FOP may still not behave exactly like those implementations either because FOP has not fully matched the desired behaviour and because the behaviour among the commercial implementations varies. The default for this option (i.e. false) is to behave exactly like the specification describes. | false |
default-page-settings | n/a | Specifies the default width and height of a page if "auto" is specified for either or both values. Use "height" and "width" attributes on the default-page-settings element to specify the two values. | "height" 11 inches, "width" 8.26 inches |
use-cache | Boolean | All fonts information that has been gathered as a result of "directory" or "auto-detect" font configurations will be cached for future rendering runs. This setting should improve performance on systems where fonts have been configured using the "directory" or "auto-detect" tag mechanisms. By default this option is switched on. | true |
cache-file | String | This option specifies the file/directory path of the fop cache file. This file is currently only used to cache font triplet information for future reference. | ${base}/conf/fop.cache |
renderers | MIME | Contains the configuration for each renderer | n/a |
/etc/fop.confSystem-wide configuration
~/.foprcUser configuration
fop.xconfExample configuration file; can be handed over with
-c option. See the section called “FOP Configuration File”
for details.
Transforms the foo.fo FO file into
PDF:
fop foo.fo foo.pdf
Does the same as the previous line:
fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
Transforms and formats foo.xml with
the help of the XSLT stylesheet foo.xsl
into the PDF file foo.pdf:
fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
Only transforms, but don't format:
fop -xml foo.xml -xsl foo.xsl -foout foo.fo
Formats foo.fo into FRTF:
fop foo.fo -mif foo.rtf
Input file is send to the printer:
fop foo.fo -print