Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This Gist contains code snippets related to conversion VSSX file to SVG format using Aspose.Diagram Cloud SDK for .NET
This Gist contains code snippets related to conversion VSSX file to SVG 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.vssx";
// resultant SVG file name
String resultant = "Conveted.svg";
try
{
// read the input VSSX file from local drive
using (var inputStream = new FileStream("C:\\Users\\Downloads\\" + inputFile, FileMode.Open))
{
// create a Storage class instance
StorageApi storageApi = new StorageApi("client_credentials", clientID, clientSecret);
// upload input VXXS file to cloud storage
storageApi.UploadFile(inputFile, inputStream);
// initiate the file conversion process
var response = diagramApi.DownloadFileWithFormat(inputFile, format: "SVG", null);
if (response != null)
{
Console.WriteLine("Successfully converted VSD to SVG !");
}
// custom method to save resultant file on local system drive
saveToDisk(response, "C:\\Users\\Downloads\\" + resultant);
}
}
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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment