VSSX to SVG

Microsoft Visio is often utilized in business settings to organize, visualize, and communicate complex workflows, such as organizational charts, database models, business flowcharts diagrams. Microsoft introduced the VSSX format when it released Visio 2013. VSSX is a Zip-based format that replaced the binary-based VSS format and can be utilized by Visio 2013 and above. Therefore, in order to open, edit, and save VSSX files, we use Microsoft Visio. But, it is only available on the Windows platform and Microsoft does not have a desktop version of Visio for macOS or Linux platform. So from a portability perspective, we may consider converting VSSX files to SVG format that has benefits like scalability, being SEO friendly, editing ability, and resolution independence on any platform. Furthermore, SVG is flexible, a W3C standard, Lightweight, Printable, Indexable, and easily Compressible.

In this article, we are going to discuss the following topics in more details

Visio file processing API

Aspose.Diagram Cloud is a REST API providing the capabilities to create, edit and render Visio diagrams to other popular formats. Also, an application based on Aspose.Diagram Cloud does not require any 3rd party software to process Microsoft Visio diagrams/flow charts and relies on its own engine. Therefore, with the help of this easy-to-use solution, you can perform complex operations over Visio files with fewer code lines. This design provides an ease to stay focused on business requirements and forget about inner implementation complexities.

Now in order to further facilitate our customers, we have created programming language-specific SDKs so that they can take benefit of Visio file processings within their favorites IDE. In order to perform Visio file conversion to SVG format in the .NET application, please try using Aspose.Diagram Cloud SDK for .NET.

Installation

The first step in using the Cloud SDK is its installation. It can be donwloaded from NuGet or GitHub. Please execute the following command in the terminal to install the SDK via NuGet:

nuget install Aspose.Diagram-Cloud

Or execute the following command in NuGet Package Manager:

 PM> Install-Package Aspose.Diagram-Cloud
NuGet Package Manager

Image 1:- Package installation using NuGet Package Manager.

Visual Studio Installation

The Cloud SDK can also be directly added inside 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 Package

Image 2:- Aspose.Diagram-Cloud in Visual Studio 2022.

Cloud subscription

After the installation, the next step is to create a free subscription account by visiting Aspose.Cloud dashboard. During subscription, no credit card or other payment details are required. Furthermore, under a free subscription account, you can perform up to 150 Free document processing requests.

So use your GitHub or Google account to simply Sign Up or, 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 3:- Client Credentials at Aspose.Cloud dashboard.

VSSX to SVG in C#

The conversion process is quick yet reliable, offering high fidelity results regardless of the resultant file format.

  • The first step is to create an instance of DiagramApi class while passing ClientID and ClientSecret details as arguments
  • Secondly, read the input VSSX content into FileStream instance
  • Thirdly, create an object of StorageApi class by passing same ClientID and Client Secret details as arguments
  • The next step is to upload VSSX file to Cloud storage using UploadFile(…) method of StorageApi
  • Now call DownloadFileWithFormat(..) method of DiagramApi to initiate the file conversion operation
  • Finally, save the resultant file on local drive using File.Create object

The input VSSX and SVG files used in above example can be downloaded from MVPSession1SimpleTimeline.vssx and converted.svg.

VSSX to SVG preview

Image 4:- Preview of VSSX to SVG conversion.

Convert VSSX to SVG using cURL command

As our Cloud API is based on REST architecture, so it can also be accessed using cURL commands. But as mentioned earlier, the APIs are only accessible to authorized persons, so based on Client ID and Client Secret details, we need to create JWT access token. 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 geneated the JWT access token, please upload the file to cloud storage using following cURL command.

curl -X PUT "https://api.aspose.cloud/v3.0/diagram/storage/file/MVPSession1SimpleTimeline.vssx" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-d {"File":{}}

Now that the file is uploaded on Cloud storage, please execute the following command to perform the conversion and save the output on specified location.

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

Conclusion

In this article, we have discussed the capabilities of Aspose.Diagram Cloud for the conversion fo VSSX file format to SVG. We have discussed the steps to perform the conversion using C# .NET code as well as using the cURL command. Our SDKs are developed under MIT license and its complete source code can be downloaded from GitHub. Furthermore, in case you encounter any issue while using the API, please feel free to contact via Free Support forum.

We also recommend you to visit following links to learn more about