Saving JGoView as SVG

I was able to successfully save my JGoView as a SVG file, however, the background image (called with setBackgroundImage(bgimage)) is not being written out in the SVG. Any suggestions? Thanks, David

The background image is considered part of the state of the view, not part of the document, which is why it and other view objects such as selection handles are not saved.
Perhaps Scott has a suggestion for that…

Yes, SVG output is performed only for objects in the document, not in the view. In fact, buildSVGDoc(), the API for writing the SVG, takes only a document arg, not a view.
You could subclass DefaultDocument and override buildSVGDoc() so that if the document had only a single view, you also generated that view’s background image. For an example of generating SVG image tags, refer to JGoImage.SVGWriteObject().
Another simpler approach is to use SVGGoView in the examples directory. This generates SVG for the view, not the document. Of course, you have limited control of the SVG that’s generated and JGo cannot read the generated SVG to recreate the document, so I don’t know if this approach will work for you.