Debian Codegraph @

documentation-sources/content/xdocs/faq.xml

raw
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 <!-- author [email protected] -->
25 <!-- version $Id$ -->
26 <!-- ====================================================================== -->
27
28 <!DOCTYPE faqs PUBLIC "-//APACHE//DTD FAQ V2.0//EN" "http://forrest.apache.org/dtd/faq-v20.dtd">
29 <faqs>
30 <title>Frequently Asked Questions</title>
31
32 <part id="part-general">
33 <title>General questions</title>
34
35 <faq id="what-is-batik">
36 <question>What is Batik?</question>
37 <answer>
38 <p>
39 Batik is a Java-based toolkit for applications or applets that want
40 to use images in the <a href="site:svg11">Scalable
41 Vector Graphics (SVG)</a> format for various purposes, such as
42 display, generation or manipulation.
43 </p>
44 </answer>
45 </faq>
46
47 <faq id="what-is-svg">
48 <question>What is SVG?</question>
49 <answer>
50 <p>
51 <a href="site:svg11">SVG</a> (Scalable Vector
52 Graphics) is an open-standard language for describing
53 two-dimensional (2D) graphics in XML. It is a Recommendation from the
54 <a href="http://www.w3.org/">W3C</a>. SVG lets you describe rich images
55 with features such as gradients, transparency, filter effects and animation.
56 </p>
57 <p>
58 SVG has three types of graphic objects: shapes (e.g., paths consisting
59 of straight lines and curves), images and text. Graphical objects can be grouped,
60 styled, transformed and composited (e.g., drawn with transparency). SVG has a
61 large set of static features which includes nested transformations, clipping
62 paths, masking and filter effects.
63 </p>
64 <p>
65 In addition, SVG images can be dynamic and interactive. A rich set of event
66 handlers such as for mouse movement and clicks can be assigned to any SVG
67 graphical object. These handlers can invoke scripts, which, in response to an
68 event, can dynamically modify the SVG graphic through the SVG Document Object Model
69 (DOM) API, allowing, for example scripts to change the color or location of graphical
70 elements.
71 </p>
72 <p>
73 SVG graphical elements can be animated through scripting. Alternatively,
74 animation sequences can be expressed directly in XML because SVG leverages the
75 <a href="site:smil">SMIL Animation</a>
76 specification for multimedia, another
77 <a href="http://www.w3.org/">W3C</a> specification.
78 </p>
79 </answer>
80 </faq>
81
82 <faq id="what-can-i-do">
83 <question>What can I do with Batik?</question>
84 <answer>
85 <p>
86 Batik contains several <a href="site:architecture">core modules</a>
87 which can be used independently or jointly to <strong>generate SVG
88 content</strong> (see the <a href="site:generator">SVG Generator</a>
89 and <a href="site:dom-api">SVG DOM</a> implementation documentation)
90 <strong>view SVG content</strong> (see the <a href="site:swing">JSVGCanvas</a>)
91 or <strong>convert to and from the SVG format</strong> (see the
92 <a href="site:transcoder">SVG Transcoder</a> page).
93 </p>
94
95 <p>
96 In addition, Batik contains
97 <a href="using/architecture.html#lowLevelComponents">low level
98 modules</a>, such as an object-oriented Graphic Vector Toolkit
99 (GVT), a set of low level parsers specific to the SVG syntax and a
100 set of <a href="site:extending">extensions</a> to the Java 2D API
101 (such as sophisticated fill types and filter effects).
102 </p>
103
104 <p>
105 Finally, Batik comes with <a href="site:tools">packaged applications</a> to help developers get
106 familiar with the code and be quickly able to use the various modules: Squiggle, an
107 <a href="site:browser">SVG browser</a> (in the
108 <code>org.apache.batik.apps.svgbrowser</code> package) an
109 <a href="site:rasterizer">SVG rasterizer</a> (in the
110 <code>org.apache.batik.apps.rasterizer</code> package), a
111 <a href="site:font-converter">Font converter</a> (in the
112 <code>org.apache.batik.apps.ttf2svg package</code>) and an
113 <a href="site:pretty-printer">SVG pretty printer</a> (in the
114 <code>org.apache.batik.apps.svgpp package</code>).</p>
115 <p>
116 Squiggle, the <a href="site:browser">SVG browser</a> can display SVG
117 documents and lets the user zoom, pan and rotate any SVG document,
118 view the SVG source, link between SVG documents, view a tree
119 representation of the SVG DOM and more. One important component of
120 the SVG viewer is the <code>org.apache.batik.swing.JSVGCanvas</code>
121 component, which can be plugged in to any Java application or applet
122 to provide SVG viewing capability.
123 </p>
124 <p>
125 The <a href="site:rasterizer">SVG rasterizer</a>
126 lets the user convert
127 SVG files to raster formats such as JPEG, PNG or TIFF . It
128 contains an extensible mechanism so that arbitrary raster
129 formats can be added. For example, the rasterizer lets you
130 create one SVG file with a special effect (e.g., shadows,
131 gradients, etc.), turn it into a PNG image, then modify the
132 SVG source (e.g., modify a piece of text or a color), and
133 generate another PNG image from it. This way, you can easily
134 generate a series of images sharing a common theme or look and
135 feel to post on a web site. (Note that the rasterizer can also
136 be used on a web server to do this conversion automatically).
137 </p>
138 <p>
139 The <a href="site:font-converter">SVG Font Converter</a>
140 lets the user easily create
141 an <a href="http://www.w3.org/TR/SVG11/fonts.html">SVG
142 Font</a> for a set of characters from a TrueType Font
143 file. That SVG Font definition can be embedded in a document
144 using the characters. This allows users to create SVG
145 documents that are self contained and do not rely on system
146 fonts, and guarantees that the SVG file will be displayed
147 exactly as it was authored on all platforms.
148 </p>
149
150 <p>
151 The <a href="site:pretty-printer">SVG Pretty Printer</a>
152 is a convenience tool to
153 pretty print an SVG document, which means that you can
154 reformat any existing SVG document to produce a nicely
155 formatted and highly legible version.
156 </p>
157 <p>
158 These applications show that Batik can be used client side
159 (the browser can be used on any client machine) and server
160 side (the rasterizer can be used to serve SVG images to client
161 machines that do not have SVG support).
162 </p>
163 </answer>
164 </faq>
165
166 <faq id="why-at-apache">
167 <question>Why do we have such a project at Apache?</question>
168 <answer>
169 <p>
170 The <a href="http://xmlgraphics.apache.org/charter.html">mission
171 of the Apache XML Graphics Project</a> is to promote the use of
172 XML-based graphics by “providing robust, full-featured,
173 commercial-quality, and freely available software packages for the
174 conversion of XML to graphical output and for related components”.
175 Batik as an open source implementation of a key format for today’s
176 and tomorrow’s web fits well in this mission.
177 </p>
178 </answer>
179 </faq>
180
181 <faq id="how-does-batik-relate">
182 <question>How does Batik relate to other Apache projects?</question>
183 <answer>
184 <p>
185 Batik is used in <a href="http://cocoon.apache.org/">Cocoon</a>
186 for server side rasterization of SVG images. In addition, the Batik is used in the
187 <a href="http://xmlgraphics.apache.org/fop/">FOP</a> project to convert
188 SVG images to PDF format.
189 </p>
190 </answer>
191
192 </faq>
193
194 <faq id="how-did-it-start">
195 <question>How did it start?</question>
196 <answer>
197 <p>
198 Batik started out because several teams doing SVG related projects decided to join
199 efforts with the idea that the whole will be greater than the sum of the parts. The
200 following companies or institutions are part of the team that contributed and/or
201 created the initial Batik project, during the fall of 2000:
202 </p>
203 <ul>
204 <li><a href="http://www.csiro.au/">CSIRO</a></li>
205 <li><a href="http://www.ilog.com/">ILOG</a></li>
206 <li><a href="http://koala.ilog.fr/">Koala Team</a></li>
207 <li><a href="http://www.kodak.com/">Eastman Kodak Company</a></li>
208 <li><a href="http://www.sun.com/">Sun Microsystems, Inc.</a></li>
209 </ul>
210 <p>
211 In addition, the Batik project is supported by <a href="http://www.ibm.com/">IBM</a>.
212 </p>
213 <p>
214 We encourage anyone to participate. As with all ASF projects, all efforts are
215 volunteer-based. We are looking for individuals to work with us on
216 fulfilling our goals for Batik in the spirit of collaborative open-source
217 software development.
218 </p>
219 </answer>
220
221 </faq>
222
223 <faq id="what-is-next">
224 <question>Where is Batik going? What is next?</question>
225 <answer>
226 <p>
227 The SVG implementation is not complete (see the current
228 <a href="site:status">status</a>), and there is more work to
229 do to achieve a fully functional viewer.
230 </p>
231
232 <p>
233 Batik 1.1 supports all static SVG features,
234 linking and a limited support for scripting, and the 1.5 release
235 completed support for scripting and dynamic documents.
236 With Batik 1.6 came many improvements to
237 the implementation of SVG DOM functions, bug fixes, performance
238 improvements, and the beginning of some SVG 1.2 support.
239 Declarative animation and some SVG 1.2 features were introduced
240 in Batik 1.7beta1. The 1.7 release brought mostly bug fixes.
241 Completion of remaining SVG 1.1 functionality and the addition
242 of Further SVG 1.2 functionality should be supported in the 2.0
243 release.
244 </p>
245 <p>
246 The type of applications (e.g., transcoding applications)
247 that can or will be added to Batik depends on contributions
248 and feedback.
249 </p>
250 </answer>
251
252 </faq>
253
254 <faq id="how-can-i-create-svg">
255 <question>How can I create and author SVG content?</question>
256 <answer>
257 <p>
258 Well, you can always use a plain text editor such as vi or
259 xemacs, but there are many graphic authoring packages that can
260 export SVG documents and that will let you author SVG content
261 visually.
262 </p>
263 <p>
264 You can get a list of tools exporting SVG from the <a
265 href="http://www.w3.org/Graphics/SVG/SVG-Implementations#edit">SVG
266 implementation</a> section of the SVG Home page on the W3C
267 web site. You can also imagine building a tool on top of
268 Batik: feel free to contribute!
269 </p>
270 <p>
271 Authoring is one way of creating SVG content, and graphic
272 authoring packages are useful for that purpose. However, there
273 are many types of graphics which can be generated, such as
274 stock quotes, statistical data, etc. For these types of
275 graphics, there are many ways to generate SVG content. For
276 example, if your data (say stock information) is contained in
277 an XML document, you could use XSLT to transform your XML data
278 into SVG. If your data comes from a database and you retrieve
279 that data in a servlet on a Web server (e.g., using JDBC), you
280 could use the Java binding for the DOM API to generate an SVG
281 document from the database data. You could also use Batik’s
282 SVG generator and use the Java 2D API to generate that
283 graphic.
284 </p>
285 <p>
286 The following URLs will be useful to learn more about each of
287 these solutions:
288 </p>
289 <ul>
290 <li><a href="http://xml.apache.org/xalan-j/index.html">Xalan for XSLT</a></li>
291 <li><a href="http://xml.apache.org/xerces-j/index.html">Xerces</a> and
292 <a href="http://java.sun.com/xml/download.html">Crimson</a> for the DOM API</li>
293 <li><a href="site:generator">SVG Generator</a></li>
294 </ul>
295 </answer>
296 </faq>
297
298 <faq id="what-other-svg-products-exist">
299 <question>What other SVG products are out there?</question>
300 <answer>
301 <p>
302 There are many companies supporting SVG and you will find a list of
303 available implementations on the
304 <a href="http://www.w3.org/Graphics/SVG/SVG-Implementations">W3C’s SVG
305 implementation page</a>.
306 </p>
307 </answer>
308 </faq>
309
310 <faq id="svg-spec">
311 <question>Where can I find the SVG specification?</question>
312 <answer>
313 <p>
314 The <a href="site:svg11">SVG specification</a> is
315 available from the <a href="http://www.w3.org/">W3C web site</a>.
316 </p>
317 </answer>
318 </faq>
319
320 <faq id="how-much-does-batik-implement">
321 <question>How much of SVG does Batik implement?</question>
322 <answer>
323 <p>
324 The <a href="site:status">status page</a> shows how much of the SVG
325 specification Batik implements by showing which of the tests in the
326 <a href="status.html#beSuiteStatus">SVG Basic Effectivity test
327 suite</a> Batik successfully passes.
328 </p>
329 </answer>
330 </faq>
331
332 <faq id="benefits-of-svg-being-xml">
333 <question>What are the benefits of SVG being an XML grammar?</question>
334 <answer>
335 <p>
336 Being an XML grammar means SVG can leverage work done around
337 XML, and SVG actually leverages other grammars such as
338 <a href="http://www.w3.org/TR/2001/REC-xlink-20010627/">XLink</a>,
339 for linking and
340 <a href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimationFramework">SMIL</a>
341 for the animation.
342 </p>
343 <p>
344 Beyond the use and mix with other XML syntaxes, being an XML grammar
345 lets SVG benefit from the plethora of XML tools that make it so easy
346 to manipulate, generate, search and edit XML files.
347 </p>
348 </answer>
349 </faq>
350
351 <faq id="what-is-in-a-name">
352 <question>Where does the name come from?</question>
353 <answer>
354 <p>
355 Batik is a highly evolved art tradition that developed in Java
356 (one of the islands comprising what is now called
357 Indonesia). Batik is generally thought of as the quintessentially
358 Indonesian textile. Motifs of flowers, twining plants, leaves,
359 buds, birds, butterflies, fish, insects and geometric forms are
360 rich in symbolic association and variety; there are about three
361 thousand recorded batik patterns.
362 </p>
363 <p>
364 We think that Batik gracefully evokes Java, graphics and
365 high-quality, terms that constitute the core of the toolkit.
366 </p>
367 <p>
368 <a href="http://www.expat.or.id/info/batik.html">This page</a>
369 shows examples of what Batik textures look like.
370 </p>
371 </answer>
372 </faq>
373 </part>
374
375 <part id="batik-help">
376 <title>Getting started with Apache Batik/SVG</title>
377
378 <faq id="system-requirements">
379 <question>What are the system requirements to run Batik?</question>
380 <answer>
381 <p>
382 Batik is written in the Java language and requires a version 1.4
383 implementation at this time.
384 </p>
385 </answer>
386 </faq>
387
388 <faq id="how-to-install">
389 <question>How do I install Batik?</question>
390 <answer>
391 <p>
392 You will need a <a href="http://java.sun.com/">JRE/JDK</a> version
393 1.4 or above to run Batik.
394 </p>
395 <p>
396 To install Batik you need to <a href="site:download">download</a>
397 the binary or source distribution and unzip it on your computer.
398 </p>
399 <p>
400 You can have a look at the <a href="site:install">installation
401 instructions</a> for more information.
402 </p>
403 </answer>
404 </faq>
405
406 <faq id="how-can-i-see-demo">
407 <question>How can I see a demo?</question>
408 <answer>
409 <p>
410 You can see an online demonstration of Squiggle the SVG
411 browser on the <a href="site:demo">demo page</a>. Alternatively, you
412 can <a href="site:download">download</a> Batik or see
413 <a href="site:browser">screenshots</a> of the Batik SVG viewer,
414 images created from the <a href="site:rasterizer">rasterizer</a> and
415 an <a href="site:generator">example</a> of how to use the
416 <code>SVGGraphics2D</code> generator.
417 </p>
418 </answer>
419 </faq>
420
421 <faq id="what-scripting-languages-batik-supports">
422 <question>What scripting languages can I use in my SVG files?</question>
423 <answer>
424 <p>
425 A limited support of scripting in SVG files is provided with
426 the current version of Batik (script are executed but dynamic
427 update is not supported).
428 </p>
429 <p>
430 Batik can recognize the following scripting languages:
431 </p>
432 <ul>
433 <li>
434 ECMAScript thanks to the
435 <a href="http://www.mozilla.org/rhino/">Mozilla Rhino</a> JavaScript
436 engine included in the distribution,
437 </li>
438 <li>
439 Python for which you need to download the
440 <a href="http://www.jython.org">Jython</a> engine, and
441 </li>
442 <li>
443 Tcl for which you need to download the
444 <a href="http://dev.scriptics.com/software/java/">Jacl</a> engine.
445 </li>
446 </ul>
447 <p>
448 To get more information on how to install optional
449 scripting languages you can have a look at the
450 <a href="site:install">installation instructions</a>.
451 </p>
452 </answer>
453 </faq>
454 </part>
455
456 <part id="batik-error">
457 <title>Troubleshooting Apache Batik</title>
458
459 <faq id="NoSuchMethodException">
460 <question>
461 When I try to run Batik it results in a NoSuchMethodException. What
462 is the problem?
463 </question>
464 <answer>
465 <p>
466 There is certainly something wrong with your classpath. Clear your
467 <code>CLASSPATH</code> environment variable and be sure to remove
468 all the libraries which use the W3C’s DOM bindings from
469 <code>jre/lib/ext</code> before running any of the Batik’s
470 applications.
471 </p>
472 </answer>
473 </faq>
474
475 <faq id="display-does-not-update">
476 <question>
477 When I change the document in Java it doesn’t update the
478 display, even if I call repaint?
479 </question>
480 <answer>
481 <p>
482 There are two common causes for this. The first is that the
483 <a class="class" href="javadoc/org/apache/batik/swing/JSVGCanvas.html">JSVGCanvas</a>
484 doesn’t know it’s a dynamic document. Normally
485 Batik detects this by looking for script elements but when you
486 modify the document from Java it can’t tell. So call
487 </p>
488 <source>myJSVGCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);</source>
489 <p>
490 before loading the document (with <code>setURI</code>,
491 <code>setDocument</code>, <code>setSVGDocument</code>, etc.).
492 </p>
493 <p>
494 The second common reason is that the changes aren’t made in
495 the
496 <a class="class" href="javadoc/org/apache/batik/bridge/UpdateManager.html">UpdateManager</a>’s
497 thread. You can run code in the <code>UpdateManager</code>’s thread
498 with the following:
499 </p>
500 <source>UpdateManager um = JSVGCanvas.getUpdateManager();
501 um.getUpdateRunnableQueue().invokeLater(Runnable);</source>
502 <p>
503 <strong>NOTE:</strong> The update manager only becomes
504 available after the first rendering completes. You can
505 be notified when this happens by registering a
506 <code>GVTTreeRendererListener</code>.
507 </p>
508 </answer>
509 </faq>
510 <faq id="must-mouseover-to-change">
511 <question>
512 When I change the document in Java it only updates if I
513 move the mouse over the canvas?
514 </question>
515 <answer>
516 <p>
517 The most common causes for this, is that the changes are not made in
518 the <code>UpdateManager</code>’s thread. See previous FAQ for
519 example code to run code in the Update Manager’s thread. Moving the
520 mouse works because it delivers the mouse move events in the update
521 thread, and after a runnable completes in the
522 <code>UpdateManager</code>’s thread it checks if the canvas needs
523 repainting.
524 </p>
525 </answer>
526 </faq>
527 <faq id="changes-are-not-rendered">
528 <question>
529 When I create new SVG elements or modify some SVG attributes through
530 the DOM API, from ECMAScript, nothing happens, the changes are not
531 rendered. Why not?
532 </question>
533 <answer>
534 <p>
535 A common problem is that script contain the wrong DOM calls
536 to create elements or modify attributes.
537 </p>
538 <p>
539 SVG elements need to be created in the SVG namespace. For example,
540 to create a <code>rect</code> element, you should use
541 </p>
542 <source>document.createElementNS(svgNS, "rect");</source>
543 <p>
544 (where <code>svgNS</code> is equal to
545 <code>"http://www.w3.org/2000/svg"</code>), which appropriately
546 creates the <code>rect</code> element in the SVG namespace. A call to
547 </p>
548 <source>document.createElement("rect")</source>
549 <p>
550 creates an element with the name <code>rect</code> but which does not
551 belong to the SVG namespace. As such, it is ignored by Batik.
552 </p>
553 <p>
554 Most SVG attributes belong to what is called the “per element type
555 partition namespace” (see the
556 <a href="http://www.w3.org/TR/REC-xml-names">Namespaces in XML</a>
557 specification). The appropriate way to set attributes on an SVG
558 element is a call to <code>setAttributeNS</code> with a namespace
559 value of <code>null</code>, for example:
560 </p>
561 <source>elt.setAttributeNS(null, "width", "40");</source>
562 <p>
563 In the Batik SVG DOM implementation, you can also use a call to
564 <code>setAttribute</code> and you can write
565 </p>
566 <source>elt.setAttribute("width", "40")</source>
567 <p>
568 However, it is important to know that some implementations make a
569 difference between <code>setAttribute(x, y)</code> and
570 <code>setAttributeNS(null, x, y)</code>, so it is goo practice
571 to use <code>setAttributeNS</code> which is the only guaranteed
572 interoperable way of setting attributes in a namespace aware DOM
573 implementation.
574 </p>
575 <p>
576 Finally, for attributes which belong to a specific namespace, like the
577 the <code>href</code> attribute on the <code>image</code> element,
578 you have to use the <code>setAttributeNS</code> method with the
579 XLink namespace. For example, assuming <code>img</code> references an
580 <code>image</code> DOM <code>Element</code>, you can modify the
581 href as follows:
582 </p>
583 <source>img.setAttributeNS(xlinkNS, "xlink:href", "myImage.jpg");</source>
584 <p>
585 where <code>xlinkNS</code> is equal to
586 <code>"http://www.w3.org/1999/xlink"</code>.
587 </p>
588 <p>
589 For more information on common authoring pitfalls, see Jonathan Watt’s
590 <a href="http://jwatt.org/svg/authoring/">SVG Authoring
591 Guidelines</a>.
592 </p>
593 </answer>
594 </faq>
595
596 <faq id="null-updatemanager">
597 <question>
598 When I get the UpdateManager from the canvas sometimes
599 it is null, why?
600 </question>
601 <answer>
602 <p>
603 The <code>JSVGCanvas</code> is highly asynchronous so when you call
604 <code>setURI</code>, <code>setDocument</code> or
605 <code>setSVGDocument</code> they return essentially immediately.
606 Behind the scenes, the canvas creates the rendering tree and does a
607 first rendering after dispatching the document <code>SVGLoad</code>
608 event. Only after this first rendering does the
609 <code>UpdateManger</code> become available.
610 </p>
611 </answer>
612 </faq>
613
614 <faq id="why-updatemanager">
615 <question>
616 Why do I have to go through the UpdateManager to
617 run my code? Can’t you just synchronize the DOM?
618 </question>
619 <answer>
620 <p>
621 It would be possible to synchronize individual calls to
622 the DOM, however in general this is almost useless for the
623 way DOM works. For example creating a single rectangle
624 element takes approximately 6 individual DOM calls. So
625 higher level synchronization is needed.
626 </p>
627 <p>
628 The use of a
629 <a class="class" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runnable.html">Runnable</a>
630 is a common way of accomplishing synchronization for a block of code.
631 This is essentially the approach that Swing takes (all Swing
632 modification should take place in the Swing thread). It was
633 considered to use the Swing event thread, but this would lock the
634 user interface while scripts were working.
635 </p>
636 </answer>
637 </faq>
638
639 <faq id="extension-tags-work-with-source-not-binary">
640 <question>
641 I can use the Batik extension tags with the source distribution
642 but not with the binary distribution. What am I missing?
643 </question>
644 <answer>
645 <p>
646 When running from the source distribution you automatically get the
647 service provider entries for the Batik extension elements
648 (such as <code>regularPolygon</code> and <code>star</code>).
649 We chose not to include these by default in the
650 binary distribution for the Batik applications.
651 </p>
652 <p>
653 There is a subdirectory called <code>extensions</code> that has jar
654 files that enable the extended elements from Batik.
655 </p>
656 </answer>
657 </faq>
658
659 <faq id="red-circles">
660 <question>
661 Why do I get red circles when I view the samples/extensions files?
662 </question>
663 <answer>
664 <p>
665 You are using the binary distribution. This distribution does not
666 include support for our example extensions (they are just examples
667 and other people can do more sophisticated things).
668 </p>
669 <p>
670 If you want to view these examples you need to use the extension
671 enabled versions of the applications in the <code>extensions</code>
672 subdirectory.
673 </p>
674 </answer>
675 </faq>
676
677 <faq id="dom-modifications-do-not-display">
678 <question>
679 I am modifying the DOM after displaying it in the JSVGCanvas,
680 but my changes aren’t shown (even if I call repaint).
681 </question>
682 <answer>
683 <p>
684 For efficiency, if Batik loads a static document it doesn’t
685 set up any dynamic support. Batik normally decides whether a
686 document is dynamic by checking if it contains any
687 <code>script</code> elements or event handler attributes. However,
688 if your Java application is modifying the DOM directly there may be
689 no script elements. In this case you need to tell Batik to set up
690 dynamic support regardless.
691 </p>
692 <p>
693 You can inform the <code>JSVGCanvas</code> that a document should
694 be handled dynamically by calling the <code>setDocumentState</code>
695 method, just before loading the document:
696 </p>
697 <source>JSVGCanvas myCanvas = ...;
698 myCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
699 myCanvas.setURI("myFile.svg");</source>
700 </answer>
701 </faq>
702
703 <faq id="batik-fails-with-fop-on-org.w3c.xxx">
704 <question>
705 I am trying to use Batik and FOP together but Batik does not work and
706 fails on the <code>org.w3c.</code>* packages. What is happening?
707 </question>
708 <answer>
709 <p>
710 Both FOP and Batik use the <code>org.w3c.</code>* packages.
711 Depending on the version of FOP and Batik, Batik has been using a
712 version of these packages which is more recent than the one in the
713 <code>xml-apis.jar</code> file FOP uses. However, if the
714 <code>xml-apis.jar</code> file that comes with the FOP distribution
715 is loaded before the Batik jar files, then the version coming with
716 FOP takes precedence (i.e., that is the version the Java Virtual
717 Machine loads). Because that version is incompatible with Batik, you
718 encounter this problem.
719 </p>
720 <p>
721 The solution is to either repackage the <code>xml-apis.jar</code> file
722 with the classes in the Batik distribution (you will need the Batik
723 source distribution to do that), or you will need to make sure the
724 Batik jars are loaded before FOP’s <code>xml-apis.jar</code>, for
725 example by putting Batik’s jar file before FOP’s in your classpath.
726 If you are copying your jar files to <code>.../jre/lib/ext</code>,
727 you can simply remove the FOP <code>xml-apis.jar</code> file from
728 that directory.
729 </p>
730 </answer>
731 </faq>
732
733 <faq id="how-to-checkout-latest-batik-via-svn">
734 <question>
735 How do I checkout the latest SVN version of Batik?
736 </question>
737 <answer>
738 <p>
739 You just have to follow the instructions on the
740 <a href="site:download">download page</a>.
741 </p>
742 </answer>
743 </faq>
744
745 <faq id="mac-os-x-messed-up-svg-files">
746 <question>
747 I’m using Mac OS X, and some of the SVG files I view are messed up
748 (things appear clipped or out of place). What do I need to do to fix
749 this?
750 </question>
751 <answer>
752 <p>
753 As of Mac OS X release 10.1.1 there still appears to be
754 problems in the Apple implementation of the Java 2D APIs. The
755 true source of these problems and/or workarounds have yet to be
756 identified (although the problems appear to be closely tied to a
757 “gstack underflow” error message from the Apple JVM). We are
758 interested in finding the source of these problems and
759 reasonable workarounds, so if you know what causes these errors
760 the Batik team would be very interested in hearing from you
761 (either directly or through the user/developer mailing lists).
762 </p>
763 <p>
764 Other things to be aware of on Mac OS X, due to fixes for
765 other problems with Java 2D under Mac OS X, you may find that
766 some filtering operations take significantly more memory than on
767 other platforms. This will be especially true for deeply nested
768 filter trees (where the result of one filtering operation is
769 filtered by another filtering operation).
770 </p>
771 <p>
772 Finally a few hints on avoiding problems under Mac OS X. The
773 bugs seems to be triggered by filters, and pure raster SVG documents
774 have not been found to cause problems. The use of the
775 <code>filterRes</code> attribute on the <code>filter</code> element
776 seems especially problematic. The bug isn’t 100% reproducible, so
777 while some content exhibits the problem, if you play with the
778 document enough it will often “fix” itself for a while, then later
779 it will go back to being broken (which indicates that the problem may
780 be some sort of race condition in the JVM).
781 </p>
782 </answer>
783 </faq>
784
785 <faq id="mac-os-x-batik-demo-crash">
786 <question>
787 I cannot run the Batik demo on Mac OS X (10.1.1). The Batik splash
788 screen hangs. What is happening?
789 </question>
790 <answer>
791 <p>
792 The Batik <a href="site:demo">demo</a> uses Java Web Start. Java Web
793 Start (under the <code>Applications/Utilities</code> folder), lets
794 you start a Java application from a web browser. You can see the
795 debug traces by enabling the Java console for Java Web Start. If you
796 do, you will see that there is a
797 <code>java.lang.NoSuchMethodError</code> exception thrown.
798 </p>
799 <p>
800 This is happening because the Java Web Start jar file
801 (<code>javaws.jar</code> in <code>/Applications/Utilities/Java Web
802 Start/Content/MacOS</code>) contains an older version of the DOM
803 bindings.
804 </p>
805 <p>
806 One work around is to manually patch the <code>javaws.jar</code>
807 file to remove the DOM bindings so that they do not take precedence
808 over the Batik ones.
809 </p>
810 </answer>
811 </faq>
812 </part>
813
814 <part id="batik-dev">
815 <title>How do I contribute to Batik Development?</title>
816
817 <faq id="how-can-i-contribute">
818 <question>How can I contribute to Apache Batik development?</question>
819 <answer>
820 <p>
821 The Batik Project is an open volunteer project in the
822 spirit of the <a href="http://www.apache.org">Apache
823 Software Foundation</a> (ASF). This means that there are
824 many ways to contribute to the project, either with direct
825 participation (coding, documenting, answering questions,
826 proposing ideas, reporting bugs, suggesting bug-fixes, etc.)
827 or by resource donation (publicity, hardware, software,
828 conference presentations, speeches, etc.). Applications that
829 use the Batik modules, such as tools or extensions, are of special
830 interest to the project.
831 </p>
832 <p>
833 The process for contributing to Batik is the same as for other
834 Java projects at Apache. A formal description of that process
835 can be found on the <a href="http://jakarta.apache.org/guidelines/index.html">Jakarta</a>
836 web site. You can also view a list of
837 <a href="site:contributors">who has contributed to Batik</a>.
838 </p>
839 <p>
840 For direct participation, we suggest that you subscribe to the
841 <a href="site:mailing-lists">Batik mailing lists</a> and to
842 checkout the
843 <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/batik/">latest
844 code</a>.
845 </p>
846 </answer>
847 </faq>
848
849 <faq id="submit-patches">
850 <question>How do I submit patches or bug fixes?</question>
851 <answer>
852 <p>
853 You can submit bug fixes and patches to the
854 <a href="mailto:[email protected]">Batik developers</a>
855 mailing list and you can enter bugs in
856 <a href="site:bugs">Bugzilla</a>.
857 </p>
858 </answer>
859 </faq>
860 </part>
861 </faqs>