If you downloaded the binary distribution of Batik, you should have
a file called batik-1.5beta3.zip
, and, after expanding that
file, a JAR (Java ARchive) file called batik-svgpp.jar
.
To start the pretty-printer, open a console, go to the directory where you
expanded the distribution (and where batik-svgpp.jar
. is located) and
simply type the following at the command prompt :
java -jar batik-svgpp.jar
[@options] [@files]
For example, if you type:
java -jar batik-svgpp.jar samples/batikFX.svg
you will see the indented document on the standard output.
You can pass options to the command line:
-newline
<cr | cr-lf | lf> lets you select the newline character(s) generated in the printed document. The default is 'lf' (unix style newline).
-tab-width
<number> lets you select the tabulation width. The default value is 4.
-doc-width
<number> lets you select the document preferred number of columns. The default value is 80.
-no-format
lets you preserve the current indentation. This option is useful to perform doctype or newline substitutions.
-xml-decl
<string> lets you set the XML declaration.
-doctype
<change | remove> lets you change or remove the doctype of the document.
-public-id
<string> lets you specify a public id to use when writing the document. This option is ignored unless '-doctype change' is specified.
-system-id
<string> lets you specify a system id to use when writing the document. This option is ignored unless '-doctype change' is specified.
For example:
java -jar batik-svgpp.jar -tab-width 2 -newline cr-lf src.svg dest.svg
will format 'src.svg' and write it to 'dest.svg' using a tabulation width of 2 and dos-style newlines.
java -jar batik-svgpp.jar -no-format -doctype change -public-id "-//W3C//DTD SVG 20000802//EN" -system-id "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd" src.svg dest.svg
will format 'src.svg' and write it to 'dest.svg', unchanged except the doctype external id which will be replaced by the specified one.