Save Visio document programmatically

Visio Drawing Save Overview

Use the Diagram.Save method to save a Microsoft Visio drawing. There are overloads that allow saving a drawing to file. The drawing can be saved in any save format supported by Aspose.Diagram. For the list of all supported save formats see the SaveFileFormat Enum.

Saving Visio Diagram

The Diagram class of the Aspose.Diagram API represents a Visio drawing and developers can save its Visio diagram object in any supported file format. To save a Microsoft Visio file, simply use the Diagram.Save method, it accepts a file name with the complete path or a file stream object. Aspose.Diagram API infers the save format from the file extension and also offers an additional SaveFileFormat parameter to specify output file format.

Save a Visio Diagram in any Supported File Format

Using Aspose.Diagram API, developers can save a Visio diagram in any supported file format as listed below: VSDX, VSDM, VSSX, VSSM, VSTX, VSTM, VDX, VSX, VTX, TIFF, PNG, BMP, EMF, JPEG, PDF, XPS, GIF, HTML, SVG and XAML

Saving Diagram Programming Sample

The example below saves a document to a file.

Specifying Visio Save Options

There are several Diagram.Save method overloads that accept a SaveOptions object. This should be an object of a class derived from the SaveOptions class. Each save format has a corresponding class that holds save options for that save format, for example, there is PdfSaveOptions for the SaveFileFormat.PDF save format.

Visio Diagram Save Options

These examples show how to:

Use of the Diagram Save Options

The code below shows how to set save options before saving a document to Visio format.

Use of the PDF Save Options

The code below shows how to set save options before saving a document to a PDF format.

Use of the HTML Save Options

The code below shows how to set save options before saving a document to a HTML format.

Use of the Image Save Options

The code below shows how to set save options before saving a document to a image format.

Use of the SVG Save Options

The code below shows how to set save options before saving a document to SVG format.