Hello!

 

 

Things I did:

- create swing component which paints into SVGGraphics2D

- write the generated document to disk using the stream method of SVGGraphics2D works fine.

The generated file is readable by Squiggle GUI and transformable into JPEG using Squiggle GUI too.

 

But i need to be independent from Squiggle GUI and try to use an implementation similar to the one used by batik-rasterizer command line interface.

Trying to use batik-rasterizer to transform my svg (generated with SVGGraphics2D) into JPEG file fails with:

... org.apache.batik.transcoder.TranscoderException: null

Enclosed Exception:

Width (0) and height (0) cannot be <= 0

        at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)

        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)

        at org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown Source)

        at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)

        at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)

        at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)

... error (SVGConverter.error.while.rasterizing.file)

 

I get the same error in my own code which should write a JPEG too.

Trying to work around this by setting the missing values fails with ClassCastException.

Code snippet:

            HashMap map = new HashMap();

            map.put(JPEGTranscoder.KEY_QUALITY, new Float(0.99));

            map.put(ImageTranscoder.KEY_BACKGROUND_COLOR, backgroundColor);

            map.put(ImageTranscoder.KEY_HEIGHT, new Float(200));

            map.put(ImageTranscoder.KEY_WIDTH, new Float(200));

            svgGraphics2D.setRenderingHints(map);

 

Trying to use the method setRenderingHint inherited from AbstractGraphics2D

public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)

does not give me a hint which Keys i should use to prevent failing while rasterizing.

 

How can i proceed to be able to read once written svg files without the use of Squiggle GUI?

 

Thank you in advance!

 

Regards

Uwe

 

Attached a svg i generated with SVGGraphics2D

<<attachment: README.pdf-transcoder.txt.svg>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to