Visio to JPG

How to open Visio files without Visio software?

Yes, in this article we are going to address the above questions. We all are aware that in order to edit and view Visio files, we need to use the Microsoft Visio application. But Visio application is not available on platforms other than Windows and in order to just view the Visio diagram, the installation and licensing can be a tedious and time-consuming effort. Furthermore, if you intend to get quick feedback over your diagram where your partner is on a mobile device, it would become quite cumbersome for a person to even view this file. So a simple and practical solution is the conversion of Visio diagrams to raster image (JPG) formats.

Before proceeding further, let’s discuss some details pertinent to the Microsoft Visio drawing template (VTX), which is saved to disc in XML file format. The template is aimed to provide a file with basic settings that can be used to create multiple Visio files of the same settings.

Visio Diagram Processing API

Aspose.Diagram Cloud is specifically developed to enable our customers to build native, web & cloud-based applications to create, view & export Visio drawings. Once you have integrated Aspose.Diagram Cloud in your application, you do not require any 3rd party software to process Microsoft Visio diagrams and flow charts. Going one step further, we have created programming language-specific SDKs which are wrappers around Cloud APIs. So in this article, we are going to transform Visio files to raster image format using C# .NET. So we need to install and configure Aspose.Diagram Cloud SDK for .NET. Please visit the following link for further information on How to install Aspose.Cloud SDKs.

VTX to JPG in C#

Please follow the instructions specified below to convert the VTX file available in Cloud storage to JPG format.

  • Firstly, create an instance of DiagramApi class while passing ClientID and ClientSecret details as arguments
  • Secondly, read the input VTX file 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 VTX 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
VTX to JPEG

Image 1:- Preview of VTX converted to JPEG.

The sample files used in the above example can be downloaded from MVPSession1SimpleTimeline.vtx and Converted.jpeg.

Convert VTX to JPG using cURL

As our Cloud APIs are developed according to REST architecture, so they can easily be accessed via cURL commands. But as a pre-requisite, we need to first generate the JWT access token based on client credential details. 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 generated the JWT access token, please execute the following command to perform the conversion operation.

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

Conclusion

This article has explained the details related to the conversion of the Microsoft Visio drawing template (VTX) to JPEG format. We have discussed the conversion of file using C# .NET code snippet as well as through cURL command. Furthermore, please note that our SDKs are developed under MIT license and its complete source code can be downloaded from GitHub. Furthermore, in case you encounter any issues while using the API, please feel free to contact us via the Free Support forum.

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