This gist explains the steps and code snippet on how to convert VTX to JPG format using Aspose.Diagram Cloud SDK for .NET.
For more information, please visit
This gist explains the steps and code snippet on how to convert VTX to JPG format using Aspose.Diagram Cloud SDK for .NET.
For more information, please visit
This Gist contains code snippets related to conversion VTX file to JPG format using Aspose.Diagram Cloud SDK for .NET |
// Get ClientID from https://dashboard.aspose.cloud/ | |
string clientSecret = "d757548a9f2558c39c2feebdf85b4c44"; | |
string clientID = "4db2f826-bf9c-42e7-8b2a-8cbca2d15553"; | |
// create an object of DiagramApi | |
DiagramApi diagramApi = new DiagramApi("client_credentials", clientID, clientSecret); | |
// input VSSX file name | |
String inputFile = "MVPSession1SimpleTimeline.vtx"; | |
// resultant file format | |
String newFormat = "JPEG"; | |
// name of output file | |
String newFileName = "Converted.jpeg"; | |
try | |
{ | |
// read the input VTX file from local drive | |
using (var inputStream = System.IO.File.OpenRead(@"C:\Users\shahbnay\Downloads\" + inputFileName)) | |
{ | |
// create a Storage class instance | |
StorageApi storageApi = new StorageApi("client_credentials", clientID, clientSecret); | |
// upload input VTX file to cloud storage | |
storageApi.UploadFile(inputFileName, inputStream); | |
// initiate the file conversion process | |
var response = diagramApi.DownloadFileWithFormat(inputFileName, format: newFormat, null); | |
if (response != null) | |
{ | |
Console.WriteLine("Successfully converted VTX to JPEG !"); | |
} | |
// custom method to save resultant file on local system drive | |
saveToDisk(response, "C:\\Users\\Downloads\\" + newFileName); | |
} | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); | |
} | |
static void saveToDisk(Stream responseStream, String resultantFile) | |
{ | |
var fileStream = File.Create(resultantFile); | |
responseStream.Seek(0, SeekOrigin.Begin); | |
responseStream.CopyTo(fileStream); | |
fileStream.Close(); | |
} |