XMLMill - convert xml to pdf with java. Generate PDF from xml/xsl.

XMLMill User Guide

Version: 3.00 Date: January 2nd, 2008
This tutorial is opened in a separate window in order to maximize the legibility of this tutorial.
To return to XMLMill, close this browser window

This page as PDFPrinter friendly pageThis guide (!) as PDF

XMLMill Batch

XMLMill can be used in batch, this means 'off-line' using command-line parameters. This way XMLMill can be used in a scheduled environment where a scheduler calls XMLMill passing the correct parameters.

XMLMill supports a 'headless' environment. This means an environment without a X server installed (which is true for many Linux/UNIX server systems).

XMLMill in Batch

XMLMill can be started in batch using the com.xmlmill.batch.Main class. The etc/ directory contains different subdirectories describing batch files that can be used to start XMLMill in different JS2E environments.

  • You must add to the classpath the .jar files representing a JAXP compliant xml-parser and xsl-transformer.
  • In case you do not use the default logging mechanism under J2SE 1.4 (or higher) (java.util.logging. implementation) you'll need to add the .jar file representing the logging mechanism.
  • Check the installation section for more information regarding JAXP.

The script calls Java and the com.xmlmill.batch.Main class with the appropriate flags and arguments (described below). The following command line, for example, uses the invoices.xml file and the invoices.xsl stylesheet in %XML_HOME%\samples\xmlxsl to generate an invoice:

[001] %JAVA_HOME% com.xmlmill.batch.Main  --xml 
      %XML_HOME%\samples\xmlxsl\invoices.xml  --xsl 
      XML_HOME%\samples\xmlxsl\invoices.xsl   --log 
      %XML_HOME%\samples\xmlxsl\log --verbose 


Please find below an overview of the flags and arguments:

GNU Long style Description
-? --help Prints the on-line help message.
-a --append Append messages to an existing log file instead of overwriting the log file. If the log file does not exist, it is created.
-c --config Defines the configuration file to use.
-e --errorflags <integer> Defines on which errors XMLMill should abort generation of the pdf document. This parameter is the sum (combination) of following values: (2) abort on errors (8) abort on warnings. Note that a fatalErrorwill always be logged and will lead to aborting the generation.
-g --loglevel <level> Defines the loglevel. The values can be: TRACE, DEBUG, INFO, WARN, ERROR, FATAL. If the value passed is different than the ones defined here, an IllegalArgumentException is thrown.
-i --validate <level> Validates the result tree. Note: This requires a JAXP 1.3 compliant implementation of the underlying transformer.
-j --jaxp <JAXP version> Define the JAXP version of the underlying implementation (1.1, 1.2 or 1.3) (default: 1.2).
-l --log <path/file> Defines an (existing) logfolder and/or logfile name. If a file-name is defined it should end with .log. If the log-folder only contains a filename (ending in .log) the log will be written in directory of first xml-file that is processed. If no log-folder is defined, no log-folder will be written. All log messages (if any) will be sent to the screen.
-m --xml <path/file> Defines the .xml or .mill file or directory containing .xml or .mill files. Multiple -m files can be defined.
-o --outputfolder <directory> Defines the (existing) outputfolder. If no outputfolder is defined, the output will be written in the directory defined by file attribute of the <output> element of the first xml-file processed.
-s --xsl <file> Defines the .xsl file that will be used to transform the .xml files. If specified this .xsl file will overrule any .xsl file defined in the .xml file (defined in the <?xml-stylesheet ...?> tag).
-t --xslt XSLT transformation only (transform .xml/.xsl file to a .mill file).
-v --verbose Enable verbose output
-x --size <integer> Define the minimum size (in bytes) the pdf document should be.
Copyright © 2001 - 2012. All rights reserved. XMLMill and XMLMill logo are trademarks of Pecunia Data Systems, bvba.
Powered by Apache CocoonPowered by XMLMill