Nevron Open Vision Documentation
Drawing Vector Image Exporter

The NDrawingVectorImageExporter lets you export the content of the active page (or portions of it) to a vector image in the SVG file format.

Saving with Dialog

The following code shows a save image file dialog that allows the user to create a vector image (in SVG format) from the active page content:

Saving with Dialog
Copy Code
NDrawingVectorImageExporter imageExporter = new NDrawingVectorImageExporter(drawingView.Document);
imageExporter.SaveAsImage(drawingView.ActivePage.Bounds, NRaster.DefaultResolution);
Saving to File or Stream

To save the exported image directly to a file or a stream, you should use the SaveToFile or SaveToStream methods respectively. If you want to save the image to an SVG stream, you can use directly the method SaveToStreamAsSvg. The following piece of code exports the active page of a drawing document to a file:

Saving to File
Copy Code
NDrawingVectorImageExporter imageExporter = new NDrawingVectorImageExporter(drawingView.Document);
imageExporter.SaveToFile(@"C:\MyImage.svg", drawingView.ActivePage.Bounds, NRaster.DefaultResolution);
Generating Vector Image

To generate an SVG document on the fly without saving it, you should use the CreateSvg method:

Generating Image
Copy Code
NDrawingVectorImageExporter imageExporter = new NDrawingVectorImageExporter(drawingView.Document);
NSvgDocument svgDocument = imageExporter.CreateSvg(drawingView.ActivePage.Bounds, NRaster.DefaultResolution);
Copying to Clipboard

To copy the image to the clipboard, you should use the CopyToClipboard method:

Generating Image
Copy Code
NDrawingVectorImageExporter imageExporter = new NDrawingVectorImageExporter(drawingView.Document);
imageExporter.CopyToClipboard(drawingView.ActivePage.Bounds, NRaster.DefaultResolution);

The CopyToClipboard method of the drawing vector image exporter will export the selected portion of drawing document's active page to SVG and will put the source code of the generated SVG to the clipboard.

Send Feedback