blob: 9d56ca345fbadd07d23535652c70f5ca0d8c1db1 [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 vincent.hardy@eng.sun.com -->
<!-- version $Id$ -->
<!-- ========================================================================= -->
<document>
<header>
<title>Batik - SVG Applet</title>
<subtitle>Viewing SVG in a Browser</subtitle>
<authors>
<person name="Vincent Hardy" email="vincent.hardy@eng.sun.com"/>
</authors>
</header>
<body>
<s1 title="Introduction">
<figure src="images/applet.jpg" alt="Batik SVG Applet" />
<p>
This page describes how to use Batik to display SVG content
in an applet. It discusses the following:
</p>
<ul>
<li><link href="#webSiteSetUp">Setting up the web site</link></li>
<li><link href="#demo">Live demo</link></li>
</ul>
</s1>
<s1 title="Setting up the SVG Applet on a web site">
<p>
In order to display SVG content in an applet, you need to:
</p>
<ul>
<li><link href="#creatingPage">Create a page </link>that will either load the applet properly
for the user or let him get the Java Pluggin(tm) needed
to view the applet</li>
<li><link href="#copyJar">Copy the batik jar</link> to the same location as the HTML
page</li>
</ul>
<anchor id="creatingPage" />
<s2 title="Creating a page for the SVG Applet">
<p>In the body of the page where you want to embed the
SVG applet, add the following:</p>
<source>
&lt;OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="600"
height="400"
codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"&gt;
&lt;PARAM NAME="code" VALUE="org.apache.batik.apps.applet.JSVGApplet" &gt;
&lt;PARAM NAME="archive" VALUE="&lt;batikDirectory&gt;/batik-svgviewer.jar" &gt;
&lt;PARAM NAME="type" VALUE="application/x-java-applet;version=1.3"&gt;
&lt;PARAM NAME="svg" VALUE="&lt;svgFileURI&gt;"&gt;
&lt;COMMENT&gt;
&lt;EMBED type="application/x-java-applet;version=1.3"
width="600"
height="400"
archive="&lt;batikDirectory&gt;/batik-svgviewer.jar"
code="org.apache.batik.apps.applet.JSVGApplet"
svg="&lt;svgFileURI&gt;"&gt;
&lt;NOEMBED&gt;
No JDK 1.2 support found!
&lt;/NOEMBED&gt;
&lt;/EMBED&gt;
&lt;/COMMENT&gt;
&lt;/OBJECT&gt;
</source>
<p>This will ensure that the user viewing the page uses
the Java Pluggin to load the Batik SVG applet and be directed to the
proper download area if he or she does not already have the
Java Pluggin installed.</p>
</s2>
<anchor id="copyJar" />
<s2 title="Copy Batik Jar on server">
<p>In order for the client to be able to load the Batik viewer applet,
you need to copy the Batik JAR to the server where the html page is located.
For example, if the applet HTML page is in the [htmlRoot] directory,
you can expand the batik-1.0beta.zip file under [htmlRoot\batik] and
setup the HTML page accordingly:</p>
<source>
&lt;OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="600"
height="400"
codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"&gt;
&lt;PARAM NAME="code" VALUE="org.apache.batik.apps.applet.JSVGApplet" &gt;
&lt;PARAM NAME="archive" VALUE="batik/batik-svgviewer.jar" &gt;
&lt;PARAM NAME="type" VALUE="application/x-java-applet;version=1.3"&gt;
&lt;PARAM NAME="svg" VALUE="batik/samples/lotoTexture.svg"&gt;
&lt;COMMENT&gt;
&lt;EMBED type="application/x-java-applet;version=1.3"
width="600"
height="400"
archive="batik/batik-svgviewer.jar"
code="org.apache.batik.apps.applet.JSVGApplet"
svg="batik/samples/logoTexture.svg"&gt;
&lt;NOEMBED&gt;
No JDK 1.2 support found!
&lt;/NOEMBED&gt;
&lt;/EMBED&gt;
&lt;/COMMENT&gt;
&lt;/OBJECT&gt;
</source>
</s2>
</s1>
<anchor id="demo" />
<s1 title="Live SVG Applet Demo">
<p>Below is the Applet that uses the technique described on this page.</p>
</s1>
</body>
</document>