I try to convert an svg into PNG. the svg document is coming from a server as a Inputstream. First, I convert the svg stream into byte array with:
byte[] streamBytes = IOUtils.toByteArray(svgStream); Then i convert the bytes into outputstream(PNG). private ByteArrayOutputStream svgToPng(byte[] streamBytes) throws TranscoderException, IOException { PNGTranscoder t = new PNGTranscoder(); TranscoderInput input = new TranscoderInput(new ByteArrayInputStream(streamBytes)); ByteArrayOutputStream ostream = new ByteArrayOutputStream(); TranscoderOutput output = new TranscoderOutput(ostream); t.transcode(input, output); ostream.flush(); // ostream.close(); return ostream; } Note: If i save the svgstream on th disk and use the following transcoderinput with uri constructor, then it works. But in my case i don't want to save on the disk. TranscoderInput input = new TranscoderInput(new File("c:/a.svg").toURI().toString()); -- View this message in context: http://batik.2283329.n4.nabble.com/Convert-into-PNG-on-the-fly-tp4079626p4079626.html Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org