| <?xml version="1.0"?> |
| <!-- |
| |
| Copyright 2000-2006 The Apache Software Foundation |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <!-- ====================================================================== --> |
| <!-- author vincent.hardy@eng.sun.com --> |
| <!-- author cjolif@ilog.fr --> |
| <!-- version $Id$ --> |
| <!-- ====================================================================== --> |
| |
| <!DOCTYPE faqs SYSTEM "./dtd/faq-v10.dtd"> |
| |
| <faqs title="Frequently Asked Questions"> |
| |
| <faq> |
| <question>What is Batik?</question> |
| <answer> |
| <p> <img src="images/batikUses.jpg" alt="Batik use cases" /> |
| Batik is a Java(tm) technology |
| based toolkit for applications or applets that want to use images in the |
| <link href="http://www.w3.org/TR/SVG/">Scalable Vector |
| Graphics (SVG)</link> format for various purposes, such as |
| viewing, generation or manipulation. |
| </p> |
| <p> |
| It is the ambition of this project to give developers a set of |
| <link href="architecture.html">core modules</link> which can |
| be used together or individually to support specific SVG |
| solutions. Examples of modules are an <link |
| href="glossary.html#SVGParser">SVG parser</link>, an <link |
| href="glossary.html#SVGGenerator">SVG generator</link> and an |
| <link href="glossary.html#SVGDOM">SVG DOM </link> |
| implementations. Another ambition of the Batik project is to |
| make it highly extensible (for example, Batik allows the |
| developer to handle <link href="extendingBatik.html">custom |
| SVG tags</link>). Even though the goal of the project is to |
| provide a set of core modules, one of the deliveries is a full |
| fledged <link href="svgviewer.html">SVG Browser</link> |
| implementation which validates the various modules and their |
| inter-operability. |
| </p> |
| <p> |
| Batik provides <link href="architecture.html">building |
| blocks</link> that developers can assemble in various ways in |
| their Java technology applications or applets to generate, |
| parse, view or convert SVG contents. For example, Batik |
| contains a Swing component that can add <link |
| href="svggen.html">SVG viewing capability</link> to all Java |
| technology applications or applets. Batik can also be used to |
| generate SVG on a client or on a server, and Batik can <link |
| href="svgrasterizer.html">convert SVG content</link> into |
| other formats such as JPEG, PNG or Tiff or other formats |
| (<link href="rasterizerTutorial.html"> transcoder API</link>). |
| Batik's goal is to make it easy for developers to handle SVG |
| content for many purposes, client-side or server-side, as |
| illustrated in the diagram. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>What is SVG?</question> |
| <answer> |
| <p> |
| <link href="http://www.w3.org/TR/SVG/">SVG</link> (Scalable Vector Graphics) is an open-standard language for describing |
| two-dimensional (2D) graphics in XML. It is a Recommendation from the |
| <link href="http://www.w3.org">W3C</link>. SVG lets you describe rich images |
| with features such as gradients, transparency, filter effects and animation. |
| </p> |
| <p> |
| SVG has three types of graphic objects: shapes (e.g., paths consisting |
| of straight lines and curves), images and text. Graphical objects can be grouped, |
| styled, transformed and composited (e.g., drawn with transparency). SVG has a |
| large set of static features which includes nested transformations, clipping |
| paths, masking and filter effects. |
| </p> |
| <p> |
| In addition, SVG images can be dynamic and interactive. A rich set of event |
| handlers such as 'onmouseover' and 'onclick' can be assigned to any SVG |
| graphical object. These handlers can invoke scripts, which, in response to an |
| event, can dynamically modify the SVG graphic through the SVG Document Object Model |
| (DOM) API, allowing, for example scripts to change the color or location of graphical |
| elements in reaction to events. </p> |
| <p>SVG graphical elements can be animated through scripting. Alternatively, |
| animation sequences can be expressed directly in XML because SVG leverages the |
| <link href="http://www.w3.org/AudioVideo/">SMIL</link> specification for multimedia, |
| another <link href="http://www.w3.org">W3C</link> specification. |
| </p> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question>What can I do with Batik?</question> |
| <answer> |
| <p> |
| Batik contains several <link href="architecture.html">core modules</link> which can be used independently or jointly to |
| <strong>generate SVG content</strong> (see the <link href="svggen.html">SVG Generator</link>, an |
| <link href="domapi.html">SVG DOM</link> implementation documentation) |
| <strong>view SVG content</strong> (see the <link href="jsvgcanvas.html">JSVGCanvas</link>) |
| or <strong>convert to and from the SVG format</strong> (see the |
| <link href="rasterizerTutorial.html">SVG Transcoders</link> tutorial). |
| </p> |
| |
| <p> |
| In addition, Batik contains <link href="architecture.html#lowLevelComponents">low level modules</link> such as |
| an object oriented Graphic Vector Toolkit (<link href="glossary.html#GVT">GVT</link>), |
| a set of low level parsers(<link href="glossary.html#SVGParser">SVG Parser</link>) specific to the SVG syntax and |
| a set of <link href="extendingBatik.html">extensions</link> to the Java 2D API (such as sophisticated fill types and |
| filter effects). |
| </p> |
| |
| <p> |
| Finally, Batik comes with <link href="toolsAndApps.html">packaged applications</link> to help developers get |
| familiar with the code and be quickly able to use the various modules: an |
| <link href="svgviewer.html">Squiggle</link> (in the |
| <code>org.apache.batik.apps.svgbrowser</code> package) an |
| <link href="svgrasterizer.html">SVG rasterizer</link> (in the |
| <code>org.apache.batik.apps.rasterizer</code> package), a |
| <link href="ttf2svg.html">Font converter</link> (in the |
| <code>org.apache.batik.apps.ttf2svg package</code>) and an |
| <link href="svgpp.html">SVG pretty printer</link> (in the |
| <code>org.apache.batik.apps.svgpp package</code>).</p> |
| <p> |
| <strong>Squiggle</strong> the SVG browser <link |
| href="svgviewer.html">(here)</link> can display SVG documents |
| and lets the user zoom, pan and rotate any SVG document, view |
| the SVG source, link between SVG documents, view a tree |
| representation of the SVG DOM and more. One important |
| component of the SVG viewer is the |
| <code>org.apache.batik.swing.JSVGCanvas</code> component which |
| can be plugged in any Java application or applet to provide |
| SVG viewing capability. |
| </p> |
| <p> |
| The <strong>SVG rasterizer</strong> <link |
| href="svgrasterizer.html">(here)</link> lets the user convert |
| SVG files to raster formats such as JPEG, PNG or Tiff . It |
| contains an extensible mechanism so that arbitrary raster |
| formats can be added. For example, the rasterizer lets you |
| create one SVG file with a special effect (e.g., shadows, |
| gradients, etc...), turn it into an PNG image, then modify the |
| SVG source (e.g., modify a piece of text or a color), and |
| generate another PNG image from it. This way, you can easily |
| generate a series of images sharing a common theme or look and |
| feel to post on a web site (note that the rasterizer can also |
| be used on a web server to do this conversion automatically). |
| </p> |
| <p> |
| The <strong>SVG Font Converter</strong><link |
| href="ttf2svg.html">(here)</link> lets the user easily create |
| an <link href="http://www.w3.org/TR/SVG/fonts.html">SVG |
| Font</link> for a set of characters from a True Type Font |
| file. That SVG Font definition can be embedded in a document |
| using the characters. This allows users to create SVG |
| documents that are self contained and do not rely on system |
| fonts, and guarantees that the SVG file will be displayed |
| exactly as it was authored on all platforms. |
| </p> |
| |
| <p> |
| The <strong>SVG Pretty Printer</strong><link |
| href="svgpp.html">(here)</link> is a convenience tool to |
| pretty print an SVG document, which means that you can |
| reformat any existing SVG document to produce a properly |
| formatted and highly legible version.</p> |
| |
| <!-- <p>The SVG Generator (in the |
| <code>org.apache.batik.util.awt.svg</code> package) that |
| allows all Java applications or applets to export their |
| graphics to the SVG format. |
| |
| The SVG generator lets all Java application or applets export |
| their graphics as SVG, using the same code used for drawing to |
| the screen or for printing. For example, an application that |
| displays a pie chart in a window, can use the SVG generator to |
| easily export the sequence of Java2D drawing calls for the pie |
| chart to a SVG format. |
| </p> |
| --> |
| |
| <p> |
| These applications show that Batik can be used client side |
| (the browser can be used on any client machine) and server |
| side (the rasterizer can be used to serve SVG images to client |
| machines that do not have SVG support). |
| </p> |
| <p> |
| <link href="svgviewer.html">Squiggle</link> the SVG browser and the |
| <link href="svgrasterizer.html">rasterizer</link> are examples |
| of some of the types of applications Batik allows. Batik's |
| <link href="architecture.html">architecture</link> allows the |
| modules to be used in many different ways so other |
| applications are possible, such as using the <link |
| href="rasterizerTutorial.html">transcoders</link> (to other |
| vector formats, such as PDF, for example). Furthermore, the |
| <link href="glossary.html">Graphic Vector Toolkit</link> could |
| be used to render other graphic formats such as <link |
| href="http://www.w3.org/TR/xhtml1/">XHTML</link>. |
| </p> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question>How can I see a demo?</question> |
| <answer> |
| <p> |
| You can see an online demonstration of Squiggle the SVG |
| browser on the <link href="batikDemo.html">demo |
| page</link>. Alternatively, you can <link |
| href="http://www.apache.org/dyn/closer.cgi/xml/batik">download</link> |
| Batik or see <link href="svgviewer.html">screenshots</link> of |
| the Batik SVG viewer, images created from the <link |
| href="svgrasterizer.html">rasterizer</link> and an <link |
| href="svggen.html">example</link> of how to use the <link |
| href="svggen.html">SVGGraphics2D</link> generator. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>Why do we have such a project at Apache?</question> |
| <answer> |
| <p> |
| <link href="http://xml.apache.org/mission.html">Apache's |
| mission</link> is to allow the web to be an open environment |
| and to remain an open environment. Batik as an open source |
| implementation of a key format for today's and tomorrow's web |
| fits well in this mission. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>How does Batik relate to other Apache projects?</question> |
| <answer> |
| <p> |
| Batik is used in <link href="http://cocoon.apache.org/">Cocoon</link> |
| for server side rasterization of SVG images. In addition, the Batik is used in the |
| <link href="http://xmlgraphics.apache.org/fop/">FOP</link> project to convert |
| SVG images to PDF format. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>How did it start?</question> |
| <answer> |
| <p> |
| Batik started out because several teams doing SVG related projects decided to join |
| efforts with the idea that the whole will be greater than the sum of the parts. The |
| following companies or institutions are part of the team that contributed and/or |
| created the initial Batik project, during the fall of 2000: |
| </p> |
| <ul> |
| <li><link href="http://www.csiro.au/">CSIRO</link></li> |
| <li><link href="http://www.ilog.com/">ILOG</link></li> |
| <li><link href="http://koala.ilog.fr/">Koala Team</link></li> |
| <li><link href="http://www.kodak.com/">Eastman Kodak Company</link></li> |
| <li><link href="http://www.sun.com">Sun Microsystems, Inc.</link></li> |
| </ul> |
| <p> |
| In addition, the Batik project is supported by <link href="http://www.ibm.com">IBM</link>. |
| </p> |
| <p> |
| We encourage anyone to participate. As with all ASF project, all efforts are |
| volunteer-based. We are looking for individuals to work with us on |
| fulfilling our goals for Batik in the spirit of collaborative open-source |
| software development. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>How can I contribute?</question> |
| <answer> |
| <p> |
| The Batik Project is an open volunteer project in the |
| spirit of the <link href="http://www.apache.org">Apache |
| Software Foundation</link> (ASF). This means that there are |
| many ways to contribute to the project, either with direct |
| participation (coding, documenting, answering questions, |
| proposing ideas, reporting bugs, suggesting bug-fixes, etc..) |
| or by resource donation (publicity, hardware, software, |
| conference presentations, speeches, etc...). Applications that |
| use the Batik modules, such as tools or extensions, are of special |
| interest to the project. |
| </p> |
| <p> |
| The process for contributing to Batik is the same as for other |
| Java projects at Apache. A formal description of that process |
| can be found on the <link |
| href="http://jakarta.apache.org/guidelines/index.html">Jakarta</link> |
| web site.(<link href="whoAreWe.html#BatikCommitters">Batik Commiters</link> and |
| <link href="whoAreWe.html#BatikContributors">Batik Contributors</link>) |
| </p> |
| <p> |
| For direct participation, we suggest you to subscribe to the |
| <link href="http://xmlgraphics.apache.org/mail.html">Batik mailing |
| list</link> (follow the link for information on how to |
| subscribe and to access the mail list archives), and to |
| checkout the <link |
| href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/batik/">latest |
| code</link>. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>Where is Batik going? What is next?</question> |
| <answer> |
| <p>The SVG implementation is not complete <link |
| href="status.html">(status)</link>, and there is more work to |
| do to achieve a fully functional viewer.</p> |
| |
| <p>Batik 1.1 supports all the <link |
| href="status.html#beSuiteStatus">static SVG features</link>, |
| linking and a limited support for <link |
| href="scripting.html">scripting</link>. Work has started on |
| <link href="status.html#DynamicTest">dynamic |
| features</link>. Scripting support with the 1.5 beta releases, |
| and declarative animation (known as SMIL animation) will be |
| supported in the 2.0 release. |
| </p> |
| <p>The type of applications (e.g., transcoding applications) |
| that can or will be added to Batik depends on contributions |
| and feedback. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>How can I create and author SVG content?</question> |
| <answer> |
| <p> |
| Well, you can always use a plain text editor such as vi or |
| xemacs, but there are many graphic authoring packages that can |
| export SVG documents and that will let you author SVG content |
| visually. |
| </p> |
| <p> |
| You can get a list of tools exporting SVG from the <link |
| href="http://www.w3.org/Graphics/SVG/SVG-Implementations#edit">SVG |
| implementation</link> section of the SVG Home page on the W3C |
| web site. You can also imagine building a tool on top of |
| Batik: feel free to contribute! |
| </p> |
| <p> |
| Authoring is one way of creating SVG content, and graphic |
| authoring packages are useful for that purpose. However, there |
| are many types of graphics which can be generated, such as |
| stock quotes, statistical data, etc. For these types of |
| graphics, there are many ways to generate SVG content. For |
| example, if your data (say stock information) is contained in |
| an XML document, you could use XSLT to transform your XML data |
| into SVG. If your data comes from a database and you retrieve |
| that data in a servlet on a Web server (e.g., using JDBC), you |
| could use the Java binding for the DOM API to generate an SVG |
| document from the data base data. You could also use Batik's |
| SVG generator and use the Java 2D API to generate that |
| graphic. |
| </p> |
| <p> |
| The following URLs will be useful to learn more about each of |
| these solutions: |
| </p> |
| <ul> |
| <li><link href="http://xalan.apache.org/">Xalan for XSLT</link></li> |
| <li><link href="http://xerces.apache.org/">Xerces</link> for the DOM API</li> |
| <li><link href="svggen.html">SVG Generator</link></li> |
| </ul> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question>What other SVG products are out there?</question> |
| <answer> |
| <p> |
| There are many companies supporting SVG and you will find a list of |
| available implementations on the <link href="http://www.w3.org/Graphics/SVG/SVG-Implementations"> |
| W3C's SVG implementation page</link> |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| |
| <question>Where can I find the SVG specification?</question> |
| <answer> |
| <p> |
| The SVG specification is available from the |
| <link href="http://www.w3.org/TR/SVG/">W3C Web site</link> |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>How much of SVG does Batik implement?</question> |
| <answer> |
| <p> |
| The following <link href="status.html">status page</link> |
| shows how much of the SVG specification Batik implements by |
| showing which of the tests in the <link |
| href="status.html#beSuiteStatus">SVG Basic Effectivity test |
| suite</link> Batik successfully passes. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>What are the benefits of SVG being an XML grammar?</question> |
| <answer> |
| <p> |
| Being an XML grammar means SVG can leverage work done around |
| XML, and SVG actually leverages other grammars such as <link |
| href="http://www.w3.org/TR/2001/REC-xlink-20010627/">XLink</link>, |
| for linking and <link |
| href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimationFramework">SMIL</link> |
| for the animation. |
| </p> |
| <p> |
| Beyond the use and mix with other XML syntaxes, being an XML grammar |
| lets SVG benefit from the plethora of XML tools that make it so easy |
| to manipulate, generate, search and edit SVG files. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| |
| <faq> |
| <question>Where does the name come from?</question> |
| <answer> |
| <p> |
| Batik is a highly evolved art tradition that developed in Java |
| (one of the islands comprising what is now called |
| Indonesia). Batik is generally thought of as the quintessentially |
| Indonesian textile. Motifs of flowers, twining plants, leaves, |
| buds, birds, butterflies, fish, insects and geometric forms are |
| rich in symbolic association and variety; there are about three |
| thousand recorded batik patterns. |
| </p> |
| <p> |
| We think that Batik gracefully evokes Java, graphics and |
| high-quality, terms that constitute the core of the toolkit. |
| </p> |
| <p> |
| The following <link href="http://www.culturalbridge.com/idgallbk1.htm"> |
| page</link> shows examples of what Batik textures look like.</p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>What are the System Requirements to run Batik?</question> |
| <answer> |
| <p> |
| Batik is written in the Java language and requires a version 1.3 |
| implementation at this time. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>How do I install Batik?</question> |
| <answer> |
| <p> |
| You will need the <link href="http://java.sun.com/">JDK |
| 1.3</link> to run Batik. |
| </p> |
| <p> |
| To install Batik you need to <link href="http://www.apache.org/dyn/closer.cgi/xml/batik">download</link> |
| the binary or source distribution and unzip it on your computer. |
| </p> |
| <p>You can have a look at the <link |
| href="install.html">installation instructions</link> for more |
| information. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>How do I submit patches or bug fixes?</question> |
| <answer> |
| <p> |
| You can submit bug fixes and patches to the <link |
| href="mailto:batik-dev@xmlgraphics.apache.org">Batik developers</link> |
| mailing list and you can enter bugs in <link |
| href="http://issues.apache.org/bugzilla/">Bugzilla</link>. |
| </p> |
| </answer> |
| |
| </faq> |
| |
| <faq> |
| <question>What scripting languages can I use in my SVG files?</question> |
| <answer> |
| <p> |
| A limited support of scripting in SVG files is provided with |
| the current version of Batik (script are executed but dynamic |
| update is not supported). |
| </p> |
| <p> |
| Batik can recognize the following scripting languages: |
| </p> |
| <ul> |
| <li>ECMAScript thanks to the <link |
| href="http://www.mozilla.org/rhino">Mozilla |
| Rhino</link> JavaScript engine included in the |
| distribution. |
| </li> |
| <li>Python for which you need to download the <link |
| href="http://www.jython.org">Jython</link> engine. |
| </li> |
| <li>Tcl for which you need to download the <link |
| href="http://dev.scriptics.com/software/java/">Jacl</link> |
| engine. |
| </li> |
| </ul> |
| <p> |
| To get more information on how to install optional |
| scripting languages you can have a look at the <link |
| href="install.html">installation instructions</link>. |
| </p> |
| </answer> |
| </faq> |
| <faq> |
| <question>When I try to run Batik it results in a |
| NoSuchMethodException. What is the problem?</question> |
| <answer> |
| <p>There is certainly something wrong with your |
| classpath. Clear your CLASSPATH environment variable and be |
| sure to remove all the libraries which use the W3C's DOM |
| bindings from <code>jre/lib/ext</code>before running any of |
| the Batik's applications.</p> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question>When I change the document in Java it doesn't update the |
| display, even if I call repaint?</question> |
| <answer> |
| <p>There are two common causes for this. The first is that |
| the JSVGCanvas doesn't know it's a dynamic document. Normally |
| Batik detects this by looking for script elements but when you |
| modify the document from Java it can't tell. So call |
| JSVGCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC) before |
| loading the document (with setURI, setDocument, setSVGDocument etc.).</p> |
| <p>The second common reason is that the changes aren't made in |
| the UpdateManager's thread. You can run code in the UpdateManager's |
| thread with the following: |
| </p> |
| <code>UpdateManager um = JSVGCanvas.getUpdateManager();</code> |
| <code>um.getUpdateRunnableQueue().invokeLater(Runnable);</code> |
| <p><strong>NOTE:</strong> The update manager only becomes |
| available after the first rendering completes. You can |
| be notified when this happens by registering a |
| GVTTreeRendererListener. |
| </p> |
| </answer> |
| </faq> |
| <faq> |
| <question>When I change the document in Java it only updates if I |
| move the mouse over the canvas?</question> |
| <answer> |
| <p>The most common causes for this, is that the changes are not made in |
| the UpdateManager's thread. See previous FAQ for example code to |
| run code in the Update Manager's thread. Moving the mouse works |
| because it delivers the mouse move events in the update thread, |
| and after a runnable completes in the Update Manager's thread it |
| checks if the canvas needs repainting.</p> |
| </answer> |
| </faq> |
| <faq> |
| <question>When I create new SVG elements or modify some |
| SVG attributes through the DOM API, from ECMA Script, |
| nothing happens, the changes are not rendered, why not?</question> |
| |
| <answer> |
| <p>A common problem is that script contain the wrong DOM calls |
| to create elements or modify attributes. </p> |
| |
| <p>SVG elements need to be |
| created in the SVG namespace. For example, to create a |
| <code><rect></code> element, you should use |
| <code>document.createElementNS(svgNS, "rect")</code>, (where |
| <code>svgNS</code> is equals to <code>"http://www.w3.org/2000/svg"</code>), |
| which appropriately creates the <code><rect></code> element in the |
| SVG namespace. A call to <code>document.createElement("rect")</code> |
| creates an element with the tag <code>rect</code> but which does not |
| belong to the SVG namespace. As such, it is ignored by Batik.</p> |
| <p>Most SVG attributes belong to what is called the 'per element type |
| partition namespace' (see the |
| <link href="http://www.w3.org/TR/REC-xml-names">Namespaces in |
| XML</link> specification). The appropriate way to set attributes on |
| an SVG element is a call to <code>setAttributeNS</code> with a namespace |
| value of <code>null</code>, for example: <code>elt.setAttributeNS(null, |
| "width", "40")</code>. In the Batik SVG DOM implementation, you can |
| also use a call to <code>setAttribute</code> and you can write |
| <code>elt.setAttribute("width", "40")</code>. However, it is important |
| to know that some implementations make a difference between |
| <code>setAttribute(x, y)</code> and |
| <code>setAttributeNS(null, x, y)</code>, so it is a better practice to use |
| <code>setAttributeNS</code> which is the only guaranteed interoperable |
| way of setting attributes in a namespace aware DOM implementation.</p> |
| <p>Finally, for attributes which belong to a specific namespace, like the |
| the href attribute on the <code><image></code> element, you have to |
| use the <code>setAttributeNS</code> method with the XLink namespace. |
| For example, assuming <code>img</code> references an |
| <code><image></code> DOM <code>Element</code>, you can modify the |
| href as follows: <code>img.setAttributeNS(xlinkNS, "xlink:href", |
| "myImage.jpg")</code> where <code>xlinkNS</code> is equal to |
| <code>"http://www.w3.org/1999/xlink"</code></p> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question>When I get the UpdateManager from the canvas sometimes |
| it is null, why?</question> |
| <answer> |
| <p>The JSVGCanvs is highly asynchronous so when you call |
| setURI, setDocument or setSVGDocument they return essentially |
| immediately. Behind the scenes the Canvas creates the rendering |
| tree and does a first rendering after running 'onload' scripts. |
| Only after this first rendering does the UpdateManger become |
| available. |
| </p> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question>Why do I have to go through the UpdateManager to |
| run my code? Can't you just synchronize the DOM?</question> |
| <answer> |
| <p>It would be possible to synchronize individual calls to |
| the DOM, however in general this is almost useless for the |
| way DOM works. For example creating a single rectangle |
| element takes approximately 6 individual DOM calls. So |
| higher level synchronization is needed. |
| </p> |
| <p>The use of a Runnable is a common way of accomplishing |
| synchronization for a block of code. This is essentially the |
| approach that Swing takes (all Swing modification should take |
| place in the Swing thread). It was considered to use the Swing |
| event thread, but this would lock the user interface while scripts |
| were working. |
| </p> |
| </answer> |
| </faq> |
| |
| |
| <faq> |
| <question> |
| I can use the Batik extension tags with the source distribution |
| but not with the binary distribution. What am I missing? |
| </question> |
| <answer> |
| <p> When running from the <link |
| href="install.html#distributions">source distribution</link> |
| you automatically get the service provider entries for the |
| Batik extension tags (regularPolygon, and star for example). |
| We chose not to include these by default in the <link |
| href="install.html#distributions">binary distribution</link> |
| for the Batik applications. |
| </p> |
| <p> There is a subdirectory called 'extensions' that has jar files |
| that enable the extended elements from Batik. </p> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question> |
| Why do I get red circles when I view the samples/extensions files? |
| </question> |
| <answer><p> |
| You are using the <link href="install.html#distributions">binary |
| distribution</link>. This distribution does not include support for |
| our example extensions (they are just examples and other people can |
| do more sophisticated things). |
| </p> |
| |
| <p> |
| If you want to view these examples you need to use the extension |
| enabled versions of the applications in the 'extensions' subdirectory. |
| </p></answer> |
| </faq> |
| |
| <faq> |
| <question> |
| I am modifying the DOM after displaying it in the JSVGCanvas, |
| but my changes aren't shown (even if I call repaint). |
| </question> |
| |
| <answer> |
| <p>For efficiency if Batik Loads a static document it doesn't |
| setup all the dynamic support. Batik normally decides a |
| document is not dynamic by checking if it contains any |
| 'script' elements. However if your Java Application is |
| modifying the DOM directly there may be no script elements. |
| In this case you need to tell Batik to setup dynamic |
| support anyways.</p> |
| |
| <p>The easiest way to do this is to call |
| org.apache.batik.swing.JSVGCanvas.setDocumentState() with the |
| constant JSVGCanvas.ALWAYS_DYNAMIC.</p> |
| </answer> |
| </faq> |
| <faq> |
| <question> |
| I am trying to use Batik and FOP together but Batik does not work and |
| fails on the <code>org.w3c.xxx packages</code>. What is happening? |
| </question> |
| |
| <answer> |
| <p>Both FOP and Batik use the <code>org.w3c.xxx |
| packages</code>. Depending on the version of FOP and Batik, |
| Batik has been using a version of these packages which is more |
| recent than the one in the w3c.jar file FOP uses. However, if |
| the <code>w3c.jar</code>, file which comes with the FOP |
| distribution is loaded before the Batik jar files, then, the |
| version coming with FOP takes precedence (i.e., that is the |
| version the Java Virtual Machine loads). Because that version |
| is incompatible with Batik, you get a failure.</p> |
| |
| <p>The solution is to either repackage the |
| <code>w3c.jar</code> file with the classes in the Batik |
| distribution (you will need the Batik source distrib to do |
| that), or you will need to make sure the Batik jars are loaded |
| before the <code>w3c.jar</code>, for example by putting them |
| before the <code>w3c.jar</code> file in your classpath. If you |
| are copying your jar files to <code>..jre/lib/ext</code>, you |
| can simply remove the FOP <code>w3c.jar</code> file from that |
| directory.</p> |
| </answer> |
| </faq> |
| <faq> |
| <question> |
| How do I checkout the latest SVN version of Batik? |
| </question> |
| <answer> |
| <p>You just have to follow the instructions posted on the |
| <link href="http://xmlgraphics.apache.org/repo.html">Apache |
| XML Graphics code repository page</link>. |
| </p> |
| </answer> |
| </faq> |
| <faq> |
| <question> |
| I'm using Mac OS X, and some of the SVG files I view are messed up (things |
| appear clipped or out of place). What do I need to do to fix this? |
| </question> |
| <answer> |
| <p>As of Mac OS X release 10.1.1 there still appear to be |
| problems in the Apple implementation of the Java 2D API's. The |
| true source of these problems and/or work arounds have yet to be |
| identified (although the problems appear to be closely tied to a |
| 'gstack underflow' error messages from the Apple JVM). We are |
| interested in finding the source of these problems and |
| reasonable work arounds, so if you know what causes these errors |
| the Batik team would be very interested in hearing from you |
| (either directly or through the user/developer mailing lists). |
| </p> |
| |
| <p>Other things to be aware of on Mac OS X, due to fixes for |
| other problems with Java 2D under Mac OS X, you may find that |
| some filtering operations take significantly more memory than on |
| other platforms. This will be especially true for deeply nested |
| filter trees (where the result of one filtering operation is |
| filtered by another filtering operation).</p> |
| |
| <p>Finally a few hints on avoiding problems under Mac OS X. The |
| bugs seems to be triggered by filters (I've never seen a pure |
| raster SVG document 'mess up'). The use of the 'filterRes' |
| attribute on the 'filter' element seems especially problematic. |
| The bug isn't 100% reproducible, so while some content has the |
| problem a lot if you play with the document enough it will often |
| 'fix' it's self for a while, then after a while it will go back |
| to being broken (this makes me think the problem may be some |
| sort of race condition in the JVM).</p> |
| </answer> |
| </faq> |
| |
| <faq> |
| <question> |
| I cannot run the Batik demo on Mac OS X (10.1.1). The Batik splash screen hangs. |
| What is happening? |
| </question> |
| <answer> |
| <p>The Batik <link href="http://xmlgraphics.apache.org/batik/batikDemo.html">demo</link> uses Java Web Start. Java Web Start (under the Applications/Utilities |
| folder), lets you start a Java application from a web browser. You can see the debug |
| traces by enabling the Java console for Java Web Start. If you do, you will see that |
| there is a <code>java.lang.NoSuchMethodError</code> exception thrown.</p> |
| <p>This is happening because the Java Web Start jar file (<code>javaws.jar in /Applications/Utilities/Java Web Start/Content/MacOS)</code> |
| contains an older version of the DOM bindings.</p> |
| <p>One work around is to manually patch the javaws.jar file to remove the DOM bindings |
| so that they do not take precedence over the Batik ones.</p> |
| </answer> |
| </faq> |
| </faqs> |