Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active January 22, 2021 02:02
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-com-gists/f7837f256dbaeec060de473b43d80bd1 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/f7837f256dbaeec060de473b43d80bd1 to your computer and use it in GitHub Desktop.
Convert Visio VSD VSDX to PDF using C#
// Close streams
pdfFileStream.Close();
pdfStream.Close();
// Create a diagram object to load a VSD/VSDX diagram
Diagram diagram = new Diagram("Diagram.vsd");
// Create memory stream and save the diagram as PDF
MemoryStream pdfStream = new MemoryStream();
diagram.Save(pdfStream, SaveFileFormat.PDF);
// Create a PDF file
FileStream pdfFileStream = new FileStream("ExportToPDF.pdf", FileMode.Create, FileAccess.Write);
// Write to the file
pdfStream.WriteTo(pdfFileStream);
// Close streams
pdfFileStream.Close();
pdfStream.Close();
// Create memory stream and save the diagram as PDF
MemoryStream pdfStream = new MemoryStream();
diagram.Save(pdfStream, SaveFileFormat.PDF);
// Create a diagram object to load a VSD/VSDX diagram
Diagram diagram = new Diagram("Diagram.vsd");
// Create a PDF file
FileStream pdfFileStream = new FileStream("ExportToPDF.pdf", FileMode.Create, FileAccess.Write);
// Write to the file
pdfStream.WriteTo(pdfFileStream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment