| Introduction |
This page describes the features of the SVG Pretty-printer utility that comes with the Batik distribution. It discusses the following: Downloading the pretty-printer Pretty-printing an SVG file The SVG Pretty-printer is a utility that can format SVG files. The tool format an SVG document according to the arguments passed on the command-line.
| Downloading the pretty-printer |
Refer to the install page and the download area to find out what to download and how to download it. Remember that you can get either the source distribution or the binary distribution.
| Pretty-printing an SVG file |
The method for starting the pretty-printer depends on the distribution of Batik that you chose to download. The following describes how to start the viewer for each distribution.
| Using the binary distribution |
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.
| Using the source distribution |
If you downloaded the source distribution of Batik, you got a zip or tar file that expanded into a directory called `xml-batik`. In that directory, you can find build scripts for the platform you are running on. For example, there is a `build.bat` script for users of the Windows platform and there is a `build.sh` script for UNIX users. To start the pretty-printer you should: Make sure the `xml-batik` directory is in your PATH environment variable Make sure the `ANT_HOME` environment variable is set to the xml-batik directory Make sure that your `JAVA_HOME` environment variable is set to your JDK installation directory Open a command line window and go to the `xml-batik` directory where the Batik distribution was expanded At the command prompt, type: Windows: `build svgpp`. UNIX: `build.sh svgpp`. This will printout a help message for the pretty-printer You can pass options to the rasterizer as follows: Windows: `build svgpp` [@options] [@files] UNIX: `build.sh svgpp` [@options] [@files] Refer to "Using the binary distribution" for an explanation of these options

Copyright © 2000-2005 The Apache Software Foundation. All Rights Reserved.