Hi Rana,

Rana Khartabil wrote:

In my code, I actually declare 'SVGGraphics2D' object once (I either use the first one or the next one), but I forgot to comment one out when I pasted the code here.
I do not use any swing components to display the graph. I use JGraph ,which is an open source library that produces a graph of nodes and edges.

I don't know the library but it is common for classes that start with 'j' to be Swing components, and if the JGraph can be added to a GUI to draw the graph of nodes and edges, then it probably is one.

The funny thing is that if I use SVGGraphics2D svgGenerator = new SVGGraphics2D(document);, I get an SVG file that is big, but totally blank when I double click on it.

This probably means that lots of images were embedded into it but they aren't part of the default 'view'. How are you viewing the document? Squiggle or the Adobe SVG Viewer (or something else)? The viewers offer different ways to pan an zoom on the document so I would try zooming out (it looks like the image is expected to be large).

There is also no scrolling capability.

SVG viewers don't typically use scroll bars. If you are using Squiggle there is a JSVGScrollPane that can be used if the document has a viewBox (the one you are generating doesn't have one, unless you add one).

However, if I use
SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document);
ImageHandler ihandler = new ImageHandlerPNGEncoder( "D:\\", null);
ctx.setImageHandler(ihandler);
SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
I acutally get a smaller SVG file which has a part of my graph in it (a few nodes), and many other temp files which has the other parts of my graph.

This means that those nodes are being drawn as 'images'. I suspect that you need to zoom out or add a viewBox to match your width and height ( viewBox="0 0 2000 2000" ).


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



Reply via email to