This article contains the details pertaining to how to convert Visio to PNG in C#. It covers the step-by-step process along with the running sample code to render a VSDX or VSD to PNG in C#. Different properties for the output image can be set to modify the generated file.
Steps to Convert Visio to PNG in C#
- Install the Aspose.Diagram API to export the Visio files
- Create an object of the Diagram class to load the input file
- Set preferences with the ImageSaveOptions class for output PNG image
- Write the output PNG image with the Save() method
These steps describe the basic algorithm to convert Visio to PNG in C#. First of all, load the source Visio diagram with an object of the Diagram class. Then configure different characteristics for the output image and export the output PNG image to a byte array, file, or stream.
Code to Convert Visio to PNG in C#
This runnable code sample is sufficient to convert VSDX to PNG in C#. However, you can select custom values and properties to set image resolution, scaling, zoom, etc. to modify the generated output image. Furthermore, the API lets you work with different overload constructors and methods that can be used to manipulate the files with memory stream, file stream, or arrays based on your needs.
This tutorial has explained the information pertaining to the process to convert VSD to PNG in C#. Whereas, if you want to learn the conversion of Visio files to PDF files, head to the article on how to convert Visio to PDF in C#.