xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Shawver" <ashaw...@actaview.com>
Subject RE: 1.1.1 transcoding
Date Thu, 20 Dec 2001 18:35:05 GMT
Thanks, Thierry.  I appreciate your time & help.  However, I am still not
getting it to work.

I created simple little test program to illustrate my problem.  The test
program has 2 parts; the first part reads an SVG file from disk(I enclosed
the one (test.svg) that I used for testing) & transcodes(this works).  The
second part uses a method in the class to create a very simple SVG Document
& transcodes it(this doesn't work).  When you run the code, you will notice
that no errors are thrown.  However the first part creates a valid jpg
whereas the second produces a blank image.  So from this I have 2 questions:
1) Why isn't the SVG Document able to be transcoded properly & 2) why isn't
the transcoder throwing an exception on the SVG Document?

Thanks again for your time,
Tony


-----Original Message-----
From: Thierry Kormann [mailto:tkormann@ilog.fr]
Sent: Wednesday, December 19, 2001 12:08 PM
To: Batik Users; Anthony Shawver
Subject: Re: 1.1.1 transcoding


On Wednesday 19 December 2001 17:50, Anthony Shawver wrote:
> Thanks, David.  However I still get the problem:
>
> Previously when transcoding, I used the new TranscoderInput(String URI)
> constructor for input, and everything works fine.  My output stream size
is
> about 5k in this instance.
>
> >> transcoder.transcode(new TranscoderInput(uri), new
>
> TranscoderOutput(ostream));
>
> However, now I'm attempting to use the new TranscoderInput(Document doc)
> constructor for input, and I do not seem to get any image output.   My
> output stream is 991 in this instance.
>
> >> transcoder.transcode(new TranscoderInput(document), new
>
> TranscoderOutput(ostream));
>
> The rest of the code (including the TranscoderOutput) is identical.  The
> only thing I can get from debugging it is the difference in output size.
> The only thing I have changed is the transcode method.  I need to do this
> because performance in unacceptable the other way.  Has anyone used the
> "document" version of transcode successfully?

The following page on our website shows how to use the ImageTranscoder with
a
Document.

http://xml.apache.org/batik/rasterizerTutorial.html

---

Things to care about:

a. Your Document must have been created using our DOMImplementation (see the
documentation on the website). This is due to the fact that we need some
special features that are *not* part of the standard DOM api. So the xerces
(or others) DOM implementation can *not* be used.

If you can not bootstrap your DOM using our DOMImplementation, you can use
the DocumentWrapper class (package org.apache.batik.dom) that will wrap your
SVG DOM subtree into another identical DOM subtree using our
DOMImplementation (xerces -> batik DOM for example).

Then, the resulting tree can be sent to the transcoder.

b. if your document uses external references (such as external use,
image...), you must specify the URL of your document (ie. that will be used
to find and load thoses external resources).

You can do that using the ((SVGOMDocument)doc).setURLObject(url)

Hpoe that helps,
Thierry.


Mime
View raw message