|
Hi; I am trying to convert a wmf file to a png file. Since I am using
batik, I am assuming I have to go wmf -> svg -> png. Here is my code: // wmf -> svg WMFTranscoder transcoder = new WMFTranscoder(); TranscoderInput input = new TranscoderInput(new ByteArrayInputStream(wmf)); ByteArrayOutputStream svg = new ByteArrayOutputStream(); TranscoderOutput output = new TranscoderOutput(svg); transcoder.transcode(input, output); // svg -> png ImageTranscoder it = new PNGTranscoder(); ByteArrayOutputStream png = new ByteArrayOutputStream(); it.transcode(new TranscoderInput(new
ByteArrayInputStream(svg.toByteArray())), new TranscoderOutput(png)); The svg created appears correct (as much as I know). It does have
<?xml version="1.0" encoding="Cp1252"?> at the top. When I run this I get: java.io.IOException: Invalid encoding name "Cp1252". at
org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at
org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
Source) at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source) at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source) at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
Source) at net.windward.util.test.DumpWmz.main(DumpWmz.java:96) Question 1: Is this the most efficient way to do this? Question 2: Why am I getting the exception? Thanks - dave www.windwardreports.com 303-499-2544 |
- Trying to convert wmf -> svg -> png David Thielen
- Re: Trying to convert wmf -> svg -> png thomas . deweese
