Hi,

Have you tried setting the URI on the TranscoderInput ( using setURI() )

If you don't do that Batik will not be able to calculate where it should look for
relative path's encountered inside the input SVG.

/Christoffer

On 22-04-2011 17:25, David Padbury wrote:

Hi Everyone,

I'm trying to transcode an SVG with image elements (<image xlink:href="my-image.png" ... />). This works great in the command line batik-rasterizer tool when the image is placed in the current working directory. However when rendering inside my own application (code snippet below) it is producing the exception "Unable to make sense of URL for connection". The batik-rasterizer must be providing some method of loading understanding local paths but I haven't been able to work out how.

Any suggestions?

/* Code snippet in Groovy */

def transcoder = new JPEGTranscoder()

transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));

def reader = new StringReader(svg)

def input = new TranscoderInput(reader)

def output = new TranscoderOutput(outputStream)

transcoder.transcode(input, output)

/* end of snippet */

Kind regards,

David.


Reply via email to