blob: 910f53f366250909bbcc6325808322d9f54b3cde [file] [log] [blame]
<?xml version="1.0"?>
<!DOCTYPE document SYSTEM "./dtd/document-v10.dtd">
<!-- ========================================================================= -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software License -->
<!-- version 1.1, a copy of which has been included with this distribution in -->
<!-- the LICENSE file. -->
<!-- ========================================================================= -->
<!-- ========================================================================= -->
<!-- author stephane@hillion.org -->
<!-- version $Id$ -->
<!-- ========================================================================= -->
<document>
<header>
<title>Batik - SVG Pretty-printer</title>
<subtitle>A SVG Pretty-printer</subtitle>
<authors>
<person name="Stephane Hillion" email="stephane@hillion.org"/>
</authors>
</header>
<body>
<s1 title="Introduction">
<p>
This page describes the features of the SVG Pretty-printer utility that
comes with the Batik distribution. It discusses the following:</p>
<ul>
<li><link href="#downloading">Downloading the pretty-printer</link></li>
<li><link href="#using">Pretty-printing an SVG file</link></li>
</ul>
<p>
The SVG Pretty-printer is a utility that can format SVG files.
The tool format a SVG document according to the arguments passed
on the command-line.
</p>
</s1>
<anchor id="downloading" />
<s1 title="Downloading the pretty-printer">
<p>Refer to the <link href="install.html">install page</link> and the
<link href="dist">download area</link> to find out what to download and how to
download it. Remember that you can get either the developer distribution
or the binary distribution.</p>
</s1>
<anchor id="using" />
<s1 title="Pretty-printing an SVG file">
<p>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.</p>
<anchor id="usingBinary" />
<s2 title="Using the binary distribution" >
<p>If you downloaded the binary distribution of Batik, you should have
gotten a file called <em>batik-1.0beta.zip</em>, and, after expanding that
file, a JAR (Java ARchive) file called <em>batik-svgpp.jar</em>.
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 :</p>
<p><em>java -jar batik-svgpp.jar [@options] [@files]</em></p>
<p>For example, if you type:</p>
<p><em>java -jar batik-svgpp.jar samples/batikFX.svg</em></p>
<p>you will see the indented document on the standard output.</p>
<p>You can pass options to the command line:</p>
<ul>
<li><em>-newline &lt;cr | cr-lf | lf&gt;</em> lets you select the newline character(s) generated in the printed document. The default is 'lf' (unix style newline).</li>
<li><em>-tab-width &lt;number&gt;</em> lets you select the tabulation width. The default value is 4.</li>
<li><em>-doc-width &lt;number&gt;</em> lets you select the document preferred number of columns. The default value is 80.</li>
<li><em>-no-format</em> lets you preserve the actual indentation. This option is useful to perform doctype or newline substitutions.</li>
<li><em>-doctype &lt;change | remove&gt;</em> lets you change or remove the doctype of the document.</li>
<li><em>-public-id &lt;string&gt;</em> lets you specify a public id to use when writing the document. This option is ignored unless '-doctype change' is specified.</li>
<li><em>-system-id &lt;string&gt;</em> lets you specify a system id to use when writing the document. This option is ignored unless '-doctype change' is specified.</li>
</ul>
<p>For example:</p>
<ul>
<li><em>java -jar batik-svg.jar -tab-width 2 -newline cr-lf src.svg dest.svg</em> will format 'src.svg' and write it to 'dest.svg' using a tabulation width of 2 and dos-style newlines.</li>
<li><em>java -jar batik-svg.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</em> will format 'src.svg' and write it to 'dest.svg', unchanged except the doctype external id which will be replaced by the specified one.</li>
</ul>
</s2>
<s2 title="Using the developer distribution">
<p>If you downloaded the developer distribution of Batik, you
got a zip or tar file that expanded into an xml-batik directory. 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.</p>
<p>To start the pretty-printer you should:</p><ul>
<li>Make sure the xml-batik directory is in your PATH environment variable</li>
<li>Make sure the ANT_HOME environment variable is set to the xml-batik directory</li>
<li>Make sure that your JAVA_HOME environment variable is set to your JDK installation
directory</li>
<li>Open a command line window and go to the xml-batik directory where the Batik
distribution was expanded</li>
<li><strong>UNIX users</strong>. If you have not done so already, make the build.sh script
executable:<br />
<em>chmod +x build.sh</em></li>
<li>At the command prompt, type: <br />
<strong>Windows: </strong><em>build svgpp</em>.<br />
<strong>UNIX: </strong><em>build.sh svgpp</em>.<br />
This will printout a
help message for the pretty-printer</li>
</ul>
<p>You can pass options to the rasterizer as follows:</p>
<p><strong>Windows: </strong><em>build svgpp -Dargs="[@options] [@files]"</em></p>
<p><strong>UNIX: </strong><em>build.sh svgpp -Dargs="[@options] [@files]"</em></p>
<p>Refer to <link href="#usingBinary">"Using the binary distribution" </link>for an explanation of these
options</p>
</s2>
</s1>
</body>
</document>