Re: Convert into PNG on the fly
Jim Blackler <[email protected]>
| Newsgroups | gmane.text.xml.batik.user |
|---|---|
| Message-ID | <CA+_JUs4GtJL_=04HchfUVy+=XMhxiNM85ZbQ0gzr997JJjVmWA@mail.gmail.com> |
What's your question Kayser? On 17 November 2011 11:06, Kayser <[email protected]> wrote: > 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: [email protected] > For additional commands, e-mail: [email protected] > >