You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Hassan-Zadeh, Martin" <Ma...@Dresdner-Bank.com> on 2005/03/21 10:29:26 UTC

Transcodingproblem

Hi,

I am using Batik for generation of SVG and later Transcoding into Jpeg and
Png.
Everything works fine, except that the resulting Jpeg or Png contains only a
part of the
graphic of the svg.
I have tried to set the height, with and the rectangle via transcoding
hints, but is is not working correctly ( example from
the batik web page).
The only think which changed that the png is not bigger but the part of the
svg graphic which is rendered stays the same.
Does anybody has a working example for transcoding an SVG beside the one
from the Batik web page.

Kind Regards

Martin



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Transcodingproblem

Posted by Glenn Thomas Hvidsten <gt...@corena.no>.
Hassan-Zadeh, Martin wrote:
> Does anybody has a working example for transcoding an SVG beside the one
> from the Batik web page.

This is how I do it in my code and shouldn't be any different for PNGs 
(since this is a JPEG-example. It should basically be the same as the 
example from the batik pages though.


String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory docFactory = new SAXSVGDocumentFactory(parser);
svgDocument = (SVGDocument) docFactory.createDocument(
               new File(this.SVGFile).toURL().toString());

JPEGTranscoder t = new JPEGTranscoder();
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
TranscoderInput input = new TranscoderInput(svgDocument);
OutputStream ostream = new FileOutputStream(
                        new File("C:\\Test.jpg").toString());
TranscoderOutput output = new TranscoderOutput(ostream);
t.transcode(input, output);
ostream.flush();
ostream.close();


Glenn Thomas Hvidsten


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org