Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud
Last active September 22, 2021 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-cloud/c671550ff6c23c962b5a54aef828514c to your computer and use it in GitHub Desktop.
Save aspose-cloud/c671550ff6c23c962b5a54aef828514c to your computer and use it in GitHub Desktop.
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