Plans | Login    

Briefing Search
Keyword:
Category:

       

    
Author Details
zarfishan zahid
seo@aspose.com
aspose.com

C# And Vb.net Code To Export Ms Visio Diagram (vsd, Vss, Vdx, Vst, Vdx, Vtx Or Vsx) To Pdf Format


This tip shows how .NET developers can export Microsoft Visio diagram to PDF format inside their own applications. Moreover, developers can also export Visio diagrams to XML, image, HTML, SVG & SWF formats using Aspose.Diagram for .NET.

BriefingWire.com, 12/04/2013 - This technical tip shows how .NET developers can export Microsoft Visio diagram to PDF inside their own applications using Aspose.Diagram for .NET. Aspose.Diagram for .NET allows reading and creating diagrams as well as lets developers export diagrams to a variety of formats: XML formats, image formats, HTML, SVG, SWF and PDF. This tip explains how to export a Microsoft Visio diagram to PDF using Aspose.Diagram for .NET. Use the Diagram class' constructor to read the diagram files and the Save method to export the diagram to any supported image format. The image below shows the VSD diagram that the code snippets below export PDF. You can use other diagram formats (VSS, VDX, VST, VDX, VTX or VSX) as well.

Export VSD diagram to PDF:

- Create an instance of the Diagram class.

- Call the Diagram classs Save method and set the output format to PDF.

The Sample code shows how to export Visio diagrams to a VSDformats

[C#]

//Call the diagram constructor to load diagram from a VSD file

Diagram diagram = new Diagram("D:\\Drawing1.vsd");

MemoryStreampdfStream = new MemoryStream();

diagram.Save(pdfStream, SaveFileFormat.PDF);

byte[] pdfContent = pdfStream.GetBuffer();

pdfStream.Close();

this.Response.Clear();

this.Response.ClearHeaders();

this.Response.Charset = "UTF-8";

this.Response.ContentEncoding = System.Text.Encoding.UTF8;

this.Response.ContentType = "application/pdf";

this.Response.AppendHeader("Content-Disposition", "attachment; filename=Diagram.pdf");

this.Response.BinaryWrite(pdfContent);

this.Response.End();

[VB.NET]

'Call the diagram constructor to load diagram from a VSD file

Dim diagram As New Diagram("D:\Drawing1.vsd")

Dim pdfStream As New MemoryStream()

diagram.Save(pdfStream, SaveFileFormat.PDF)

Dim pdfContent() As Byte = pdfStream.GetBuffer()

pdfStream.Close()

Me.Response.Clear()

Me.Response.ClearHeaders()

Me.Response.Charset = "UTF-8"

Me.Response.ContentEncoding = System.Text.Encoding.UTF8

Me.Response.ContentType = "application/pdf"

Me.Response.AppendHeader("Content-Disposition", "attachment; filename=Diagram.pdf")

Me.Response.BinaryWrite(pdfContent)

Me.Response.End()

Overview: Aspose.Diagram for .NET

Aspose.Diagram is a class library for working with MS Visio files & is a pure .NET alternate for MS Visio Object Model.It enables developers to work with VSD & VDX files on ASP.NET web applications, web services & Windows applications. It makes use of the advanced functionality of Visio's services to manipulate Visio docs on a server. Developer can open files & manipulate the elements of the diagram, from lines and fills, to more complex elements, and then export to native Visio formats or XML.

More about Aspose.Diagram for .NET

- Homepage of Aspose.Diagram for .NET: http://www.aspose.com/categories/.net-components/aspose.diagram-for-.net/default.aspx

- Download Aspose.Diagram for .NET: http://www.aspose.com/community/files/51/.net-components/aspose.diagram-for-.net/default.aspx

- More Technical Tips about Working with Visio Diagrams: http://www.aspose.com/docs/display/diagramnet/Working+with+Diagrams

Contact Information

Aspose Pty Ltd

Suite 163, 79 Longueville Road

Lane Cove, NSW, 2066

Australia

http://www.aspose.com/

sales@aspose.com

Phone: 888.277.6734

Fax: 866.810.9465

 
 
FAQs | Contact Us | Terms & Conditions | Privacy Policy
© 2026 Proserve Technology, Inc.