VSD to SVG

VSD file format is the native format of the Microsoft Visio application and contains advanced diagrams and vector graphics. This format made the presentation of diagrams, organizational charts, and complicated flowcharts quite handly. However, in order to view these files, specific software such as Microsoft Visio, etc is required, and also, if we need to put these details over the webpage, it gets quite complicated. Therefore, we may opt to convert the VSD files to Scalable Vector Graphics (SVG) format. Once we have the SVG, it can be referenced directly into the HTML document using the tag. So in this article, we are going to shed some light on steps to convert VSD to SVG using C# .NET REST API.

Visio Files Processing API

Aspose.Diagram Cloud is our REST API enabling our users to create, edit and transform Visio files and flow charts to other supported formats. Perform all these operations without installing Microsoft Visio or other applications. Furthermore, we have created free SDKs as wrappers around Cloud API so that you can perform all document processing operations within the language of your choice. So. in this article, we are going to discuss the conversion operations using Aspose.Diagram Cloud SDK for .NET.

Installation

The first step in using the Cloud SDK is installation. It is available for download over NuGet and GitHub. You may consider executing the following command in the terminal to install the SDK via NuGet:

nuget install Aspose.Diagram-Cloud

NuGet Package Manager

Or execute the following command in Package Manager Console in Visual Studio to fetch & reference Aspose.Diagram assembly in your project.

PM> Install-Package Aspose.Diagram-Cloud

If you already have Aspose.Diagram Cloud SDK for .NET and want to upgrade it, please execute to get the latest version.

Update-Package Aspose.Diagram-Cloud

Visual Studio

Another approach is the installation directly within Visual Studio solution:

  1. Open the Solution Explorer.
  2. Expand the project and Right-click Packages folder within your solution.
  3. Select Manage NuGet Packages… option
  4. Click on the Browse tab and search for “Aspose.Diagram-Cloud“.
  5. Click on the Aspose.Diagram-Cloud package, select the appropriate version in the right-tab and click Add Package button.
Aspose.Diagram-Cloud reference

Image 1:- Aspose.Diagram Cloud as NuGet package.

Cloud subscription

After the installation, the next major step in setup and configuration is a free account subscription over Aspose.Cloud dashboard. No credit card or other payment details are required and under a free subscription account, you can perform up to 150 Free document processing requests. So if you have GitHub or Google account, simply Sign Up. Otherwise, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.

Client Credentials

Image 2:- Client Credentials at Aspose.Cloud dashboard.

Convert VSD to SVG in C#

Please follow the instructions specified below to convert VSD files to SVG format using the C# .NET code snippet. Please note that this code snippet expects that the input VSD file shall be in cloud storage.

  • First of all, use string variables to define Client Credetials
  • Secondly, create an instance of DiagramApi while passing Client Credentials details as argument
  • Thridly, call DownloadFileWithFormat(..) method of DiagramApi to perform the conversion operation
  • Finally, use the File.Create object (as shown in saveToDisk method) to save output on local system

The sample files used in above example can be downloaded from Purchase Order Flowchart.vsd and Converted.svg.

Converted SVG preview

Image 3:- Preview of the resultant SVG file.

Convert VSD to SVG using cURL Command

Since our APIs are developed according to REST architecture, so they can also be accessed through the cURL commands. Also, please note that in order to access the APIs, we need to generate a JWT access token based on our personalized client credentials. Please execute the following command for JWT access token generation.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=4ccf1790-accc-41e9-8d18-a78dbb2ed1aa&client_secret=caac6e3d4a4724b2feb53f4e460eade3" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once we have the JWT token, we can perform the conversion using the following command.

curl -X GET "https://api.aspose.cloud/v3.0/diagram/Raise-PO-Process-Flow-Chart.vsd?format=SVG" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>" \
-o Converted.svg

Conclusion

In this article, we have discussed the simple steps on how to load and convert VSD to SVG using C#. Apart from the code snippet, we have also explored the possibilities of converting Visio files to SVG through the cURL commands. Please note that our SDKs are offered under an MIT license and can be downloaded from GitHub. In case you encounter any issues while using the API or you have any related queries, please feel free to contact us via the Free Support forum.

Quick Tip

In order to view the VSD files, you may try using our Free Online Visio Viewer.

We also recommend visiting the following links to learn more about