You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Thomas DeWeese <Th...@Kodak.com> on 2005/07/19 12:05:32 UTC
Re: Ecmascript with Batik
Hi Bader,
bader houmad wrote:
> In my application I use batik to draw some shapes that I want to animate
> (e.g: to change the width when the value that represents the width
> changes in the Data base), the animation is done with Ecmascript, but I
> do not know how to get the values i want (in real time/ during the
> animation) from my drawing while they are changing.
Well if you have access to the database from Java you don't have
to go through ecma-script to update the display you can modify the
Document directly from Java using the standard XML DOM (just make
sure all modifications are made in the Update manager thread, this
is covered in the 'Java Scripting' section of the Batik website).
If you want to do all of it from ecmascript this sort of thing
is usually done using the call 'getURL' which would allow you to
retrieve data from a remote server - however 'real time' here would
have to mean every couple of seconds.
The very basics of both of these are covered in Scripting section
of the Batik home page starting with ScriptingIntro:
http://xml.apache.org/batik/scripting.html
Also there are quite a number of scripting examples in the
samples directory of Batik.
> can some body give me a link of a tutorial that explains how to use
> Ecmascript with Batik?
If what you are really looking for is how to use Ecmascript with
'SVG' you might want to check you the svg-developers mail-list in
Yahoo Groups. This is their main focus.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Batik Servlet
Posted by "Kenneth B. Harwood" <ru...@comcast.net>.
This thread (originally started on 11-November-2004) was
very helpful. TW's posted advice (see below) just solved
my (almost identical) problem.
I was trying to convert a (200 KB) .svg to a (thumbnail-
sized) .jpg using batik's transcoder API. My configuration:
Batik 1.6
J2SE 5.0
Tomcat 5.5.9
Win2K Pro
I experienced the same sort of "TranscoderException":
Enclosed exception:null ... The URI "#linearGradient ...
is invalid ..
BTW, TW's code solution has incorrect syntax. Here's my
modification:
in.setURI(f.toURI().toString());
Regards,
- Kenneth Harwood
-------------------------------------------------------
On Thu, 11 Nov 2004 06:02:00 -0500, Thomas DeWeese
<th...@kodak.com> wrote:
> Rob wrote:
> > Further to my previous email to the mailing list, I've now tried the following:
>
> [...]
>
> > That much nicer I think, but I still get an error unfortunately. The
> > error now is:
> > Exception in thread "main" org.apache.batik.transcoder.TranscoderException: null
> >
> > Enclosed Exception:
> > null:-1
> > The URI "#linearGradient7024"
> > specified on the element <linearGradient> is invalid
>
> This is probably due to the use of streams. With a stream it
> doesn't know the 'base URL' for the document. I had thought that
> we had worked this out for internal references but it appears there
> is at least a few cases we missed. Anyway I think the fix is simple:
>
> File f = new File("c:\\temp\\1.svg");
> FileInputStream is = new FileInputStream(f);
> TranscoderInput in = new TranscoderInput(is);
> in.setURI(f.toURL());
no flowtext, missing extension, etc.
Posted by "Kenneth B. Harwood" <ru...@comcast.net>.
flowText.svg loads properly within Squiggle
but i cannot get the "inside" text to
render from my JApplet. if you executed
Squiggle w/out a {batik-extension.jar} in the
<ext> directory you'd get the same result.
i've been through the documentation and user-
list N X. AFAIK i am following batik/java's
"Service" spec carefully.
SAMPLE CODE (Abbreviated):
SAXSVGDocumentFactory f= new SAXSVGDocumentFactory();
Document myDoc= f.createDocument(myURI);
jSVGCanvas.setDocument(myDoc);
i've examined the batik source. it looks like
using <SAXSVGDocumentFactory> *automatically*
creates an SVGDOMImplementation (default)
instance. although that *should* activate the
Service mechanism to load the DOM extensions,
i don't seem to load any. i have not stepped
into the batik source, however when i examine
LinkedList of extensions at runtime, my list
has Zero length. please see
ExtensibleDOMImplementation.java:
protected static List extensions = null;
protected synchronized static List getDomExtensions() {
if (extensions != null)
return extensions;
extensions = new LinkedList(); // attaches o.k.
Iterator iter = Service.providers(DomExtension.class);
while (iter.hasNext()) { // as though test always fails
DomExtension de = (DomExtension)iter.next();
...
}
SAMPLE JARs:
myapplet.jar
------------
meta-inf/Manifest.mf
Class-Path: batik-extension.jar myclasses.jar
meta-inf/Services/org.apache.batik.bridge.BridgeExtension (stolen ..)
meta-inf/Services/org.apache.batik.dom.DomExtension (stolen ..)
batik-extension.jar
-------------------
stolen from batik distribution
myclasses.jar
-------------
a whole bunch of my java classes
if i can get some insight into what i am
doing wrong with the DOM extensions i'm
sure i can figure out how to load the
Bridge extensions.
anyone have any insights?
thanks.
- ken h.