com.xmlmind.ditac.convert.Converter
Quick and easy embedding: embed
com.xmlmind.ditac.convert.Converter
, the Java™ class which is used to implement the
ditac
command-line utility.
ditac
command-line utility. Its run method accepts the same string arguments as
the ditac
command-line
utility.Embed1
sample is found
in Embed1.java
.Converter
.StyleSheetCache cache = new StyleSheetCache(); Console console = new Console() { public void showMessage(String message, MessageType messageType) { System.err.println(message); } }; Converter converter = new Converter(cache, console);
Converter
s.StyleSheetCache
, Converter
is
not thread-safe. Each thread must own its
Converter
. However, the run
method of a Converter
may be invoked several
times.Converter
.Converter
.if (!converter.registerFOP("/opt/fop/fop")) { return 1; }
Converter
. From high-level ones to
low-level ones, these methods are: registerFOP , registerXEP , registerAHF , registerXFC , registerExternalFOConverter , registerFOConverter .run
method.String[] args = { "-v", "-p", "number", "all", outFile.getPath(), inFile.getPath(), }; return converter.run(args);
run
method returns
0 if the conversion is successful and an integer greater than 0
otherwise. When the conversion fails, errors messages are displayed on
the Console
.ditac.jar
, xmlresolver.jar
,
saxon12.jar
, etc, which are all listed in
ditac_install_dir/doc/manual/embed/build.xml
(see below), this kind of embedding also needs to access:ditac_install_dir/schema/
.ditac_install_dir/xsl/
.ditac_install_dir/schema/catalog.xml
or to an equivalent of this XML catalog.ditac_install_dir/schema/catalog.xml
contains the following entry:
<rewriteURI uriStartString="ditac-xsl:" rewritePrefix="../xsl/" />This
<rewriteURI>
entry is
needed to find the location of the directory containing the XSL
stylesheets. Make sure that this entry exists in your XML catalogs and
that it points to the actual location of the directory containing the
XSL stylesheets.Embed1
sampleEmbed1
sample by running
ant
in
ditac_install_dir/doc/manual/embed/
.Embed1
sample by running
ant
embed1 in
ditac_install_dir/doc/manual/embed/
.
This will convert
ditac_install_dir/docsrc/manual/manual.ditamap
to
ditac_install_dir/doc/manual/embed/manual.pdf
,
using Apache FOP.Embed1.java
contains “hardwired filenames” like "/opt/fop/fop"
.
This means that, without modifications, this sample cannot be run from
elsewhere than
ditac_install_dir/doc/manual/embed/
and that you'll almost certainly need to modify the source code in order
to specify the actual location of the fop
(fop.bat
) script.