| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
<!-- |
| 4 |
|
| 5 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 6 |
contributor license agreements. See the NOTICE file distributed with |
| 7 |
this work for additional information regarding copyright ownership. |
| 8 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 9 |
(the "License"); you may not use this file except in compliance with |
| 10 |
the License. You may obtain a copy of the License at |
| 11 |
|
| 12 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 13 |
|
| 14 |
Unless required by applicable law or agreed to in writing, software |
| 15 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 16 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 |
See the License for the specific language governing permissions and |
| 18 |
limitations under the License. |
| 19 |
|
| 20 |
--> |
| 21 |
|
| 22 |
<!-- ========================================================================= --> |
| 23 |
<!-- author [email protected] --> |
| 24 |
<!-- version $Id$ --> |
| 25 |
<!-- ========================================================================= --> |
| 26 |
|
| 27 |
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> |
| 28 |
<document> |
| 29 |
<header> |
| 30 |
<title>SVG Pretty Printer</title> |
| 31 |
</header> |
| 32 |
|
| 33 |
<body> |
| 34 |
<p> |
| 35 |
This page describes the features of the SVG pretty printer utility that |
| 36 |
comes with the Batik distribution. The SVG pretty printer is a utility |
| 37 |
that can format SVG files. The tool formats an SVG document according to |
| 38 |
the arguments passed on the command line. |
| 39 |
</p> |
| 40 |
|
| 41 |
<section id="downloading"> |
| 42 |
<title>Downloading the pretty printer</title> |
| 43 |
|
| 44 |
<p> |
| 45 |
Refer to the <a href="site:install">install page</a> and the |
| 46 |
<a href="site:download">download page</a> to find out what to |
| 47 |
download and how to download it. Remember that you can get either the |
| 48 |
source or binary distribution. |
| 49 |
</p> |
| 50 |
</section> |
| 51 |
|
| 52 |
<section id="using"> |
| 53 |
<title>Pretty printing an SVG file</title> |
| 54 |
|
| 55 |
<p> |
| 56 |
The method for starting the pretty-printer depends on the distribution |
| 57 |
of Batik that you chose to download. The following describes how to |
| 58 |
run the pretty printer for each distribution. |
| 59 |
</p> |
| 60 |
|
| 61 |
<section id="using-binary"> |
| 62 |
<title>Using the binary distribution</title> |
| 63 |
|
| 64 |
<p> |
| 65 |
If you downloaded the binary distribution of Batik, you should have |
| 66 |
a file called <code>batik-1.6.zip</code> (or similar), and, after |
| 67 |
expanding that file, a jar file called <code>batik-svgpp.jar</code>. |
| 68 |
To start the pretty printer, open a console, change to the directory |
| 69 |
where you expanded the distribution (and where |
| 70 |
<code>batik-svgpp.jar</code> is located) and simply type the following |
| 71 |
at the command prompt: |
| 72 |
</p> |
| 73 |
<source>java -jar batik-svgpp.jar <em>[OPTIONS] FILES</em></source> |
| 74 |
<p>For example, if you type:</p> |
| 75 |
<p><code>java -jar batik-svgpp.jar samples/batikFX.svg</code></p> |
| 76 |
<p>you will see the indented document written to standard output.</p> |
| 77 |
|
| 78 |
<p>For the options:</p> |
| 79 |
<dl class="options"> |
| 80 |
<dt><strong>-newline cr</strong><em>|</em><strong>cr-lf</strong><em>|</em><strong>lf</strong></dt> |
| 81 |
<dd> |
| 82 |
<p>specifies the newline character(s) generated in the printed |
| 83 |
document, the default being <code>lf</code> (Unix-style |
| 84 |
newlines),</p> |
| 85 |
</dd> |
| 86 |
<dt><strong>-tab-width</strong> <em>number</em></dt> |
| 87 |
<dd> |
| 88 |
<p>specifies the tabulation width, the default being 4,</p> |
| 89 |
</dd> |
| 90 |
<dt><strong>-doc-width</strong> <em>number</em></dt> |
| 91 |
<dd> |
| 92 |
<p>specifies the maximum number of columns for the whole document, |
| 93 |
the default being 80,</p> |
| 94 |
</dd> |
| 95 |
<dt><strong>-no-format</strong></dt> |
| 96 |
<dd> |
| 97 |
<p>specifies that the current indentation should be preserved, |
| 98 |
useful for performing doctype or newline substitutions,</p> |
| 99 |
</dd> |
| 100 |
<dt><strong>-xml-decl</strong> <em>string</em></dt> |
| 101 |
<dd> |
| 102 |
<p>specifies the XML declaration,</p> |
| 103 |
</dd> |
| 104 |
<dt><strong>-doctype change</strong><em>|</em><strong>remove</strong></dt> |
| 105 |
<dd> |
| 106 |
<p>specifies whether the doctype should be changed or removed,</p> |
| 107 |
</dd> |
| 108 |
<dt><strong>-publid-id</strong> <em>string</em></dt> |
| 109 |
<dd> |
| 110 |
<p>specifies the public ID to in the doctype declaration, when |
| 111 |
<code>-doctype change</code> is specified, and</p> |
| 112 |
</dd> |
| 113 |
<dt><strong>-system-id</strong> <em>string</em></dt> |
| 114 |
<dd> |
| 115 |
<p>specifies the system ID to in the doctype declaration, when |
| 116 |
<code>-doctype change</code> is specified.</p> |
| 117 |
</dd> |
| 118 |
</dl> |
| 119 |
<p>For example:</p> |
| 120 |
<source>java -jar batik-svgpp.jar -tab-width 2 -newline cr-lf src.svg dest.svg</source> |
| 121 |
<p> |
| 122 |
will format <code>src.svg</code> and write it to |
| 123 |
<code>dest.svg</code> using a tabulation width of 2 and Windows-style |
| 124 |
newlines, and: |
| 125 |
</p> |
| 126 |
<source>java -jar batik-svgpp.jar -no-format -doctype change -public-id "-//W3C//DTD SVG 1.1//EN" <strong class="cont">\</strong> |
| 127 |
-system-id "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" src.svg dest.svg</source> |
| 128 |
<p> |
| 129 |
will format <code>src.svg</code> and write it to |
| 130 |
<code>dest.svg</code> unchanged, except for the doctype public and |
| 131 |
system IDs, which will be replaced by those specified. |
| 132 |
</p> |
| 133 |
</section> |
| 134 |
|
| 135 |
<section id="using-source"> |
| 136 |
<title>Using the source distribution</title> |
| 137 |
|
| 138 |
<p> |
| 139 |
If you downloaded the source distribution of Batik, you will have a |
| 140 |
zip or tar file that expanded into a directory called |
| 141 |
<code>xml-batik</code> or <code>batik-<em>version</em></code>. In that |
| 142 |
directory, you can find build scripts for the platform you are running |
| 143 |
on. For example, there is a <code>build.bat</code> script for users of |
| 144 |
the Windows platform and there is a <code>build.sh</code> script for |
| 145 |
UNIX users. |
| 146 |
</p> |
| 147 |
<p> |
| 148 |
To start the pretty printer you should: |
| 149 |
</p> |
| 150 |
<ul> |
| 151 |
<li> |
| 152 |
<p>Make sure that your <code>JAVA_HOME</code> environment |
| 153 |
variable is set to your JDK installation directory.</p> |
| 154 |
</li> |
| 155 |
<li> |
| 156 |
<p>Open a command line window and go to the <code>xml-batik</code> |
| 157 |
or <code>batik-<em>version</em></code> directory where the Batik |
| 158 |
distribution was expanded.</p> |
| 159 |
</li> |
| 160 |
<li> |
| 161 |
<p>For Windows, type the following at the command prompt:</p> |
| 162 |
<source>build svgpp</source> |
| 163 |
<p>and for Unix:</p> |
| 164 |
<source>./build.sh svgpp</source> |
| 165 |
<p>This will print out a help message for the pretty printer.</p> |
| 166 |
</li> |
| 167 |
</ul> |
| 168 |
<p>You can pass options to the rasterizer as follows, for Windows:</p> |
| 169 |
<source>build svgpp <em>[OPTIONS] FILES</em></source> |
| 170 |
<p>and for Unix:</p> |
| 171 |
<source>./build.sh svgpp <em>[OPTIONS] FILES</em></source> |
| 172 |
<p>Refer to <a href="#using-binary">“Using the binary distribution”</a> |
| 173 |
for an explanation of these options.</p> |
| 174 |
</section> |
| 175 |
|
| 176 |
</section> |
| 177 |
</body> |
| 178 |
</document> |