I'm trying to create JPEG files using JPEGTranscoder(). I was able to do
it by passing a file URL, or an InputStream to
the JPEGTranscoder constructor, but not with an SVGDocument.
The SVGDocument is generated with an XSL transformation using Xalan:
DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
Document document =
domImpl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg",
null);
DOMResult domResult = new DOMResult(document.getDocumentElement()); //
should I be passing something else than document.getDocumentElement()
here?
transformer.transform(sourceXML, domResult);
This makes a DOM containing a SVG document.
I then try to transform it to JPEG using a JPEGTranscoder:
TranscoderInput input = new TranscoderInput(document);
OutputStream ostream = new FileOutputStream("test.jpg");
TranscoderOutput output = new TranscoderOutputStream(ostream);
t.transcode(input, output);
ostream.flush();
ostream.close();
I then get a TranscoderException with "null" as the message, with the
following stack trace:
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
null
at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:262)
at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:126)
at
org.apache.jsp.batik_0005ftest$jsp._jspService(batik_0005ftest$jsp.java:186)
...
Does anyone have an idea what could be causing this exception?
Am I doing something wrong when I transform my XML to a SVGDocument
using Xalan?
If I output the result of the XSL transformation to a file, and then
call the TranscoderInput constructor
by giving it the generated SVG file name, the JPG file is generated
correctly, so I don't think
it's an error in the generated SVG file.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]