Version 3.0.2 SVG Generation Error

For some reason, all my SVG files are being cut-off at different places in the generation after upgrading to 3.0.2. One example below. Is this a known problem?

<g transform="
No known problems...
What version were you running?
Can you post or email us your calls to SVG generation?

Does the problem happen with some graphs and not others? I’m not able to reproduce any problems with Demo1’s SVG export.

Demo works fine. Just with diagrams in my program. I’m going to reinstall everything on a fresh machine to see if the same thing happens.

You didn’t say which overload of Generate you are calling.

Are you sure that you are Close()ing the stream or writer afterwards, in case it needs to flush any buffers?

This is what I have. Stream is closed. A big mystery right now. Works fine with version 2.6.2.

            FormDrawing canvas = Program.MainForm.CreateNewDocument(diagram._Name);
            canvas.loadDiagram(diagram, false);
            float zoomScale;
            float.TryParse(m_zoomScale, out zoomScale);
            SvgWriter w = new SvgWriter();
            w._ZoomScale = zoomScale;
            w.ObjectsLimitedToDocExtent = false;
            w.View = canvas._GoView;
            string svgFile = String.Format("{0}\\contents\\D{1}.SVG", m_outputDirectory, diagram._ID);

            FileStream fs1 = new FileStream(svgFile, FileMode.Create);
            w.Generate(w.View.DocExtent, 10.0f, fs1);

Aha! I believe that is our bug, where we aren’t properly flushing/closing an intermediate stream. Try the following code, replacing your last three lines:

using (XmlWriter xw = XmlWriter.Create(svgFile, w.XmlWriterSettings)) {
w.Generate(w.View.DocExtent, 10.0f, xw);

I hope I typed that correctly. Sorry about the trouble.

Great!! That fixed the problem. Thanks for tracking down the problem so fast.