Business diagrams and flow charts offer a great deal in data presentation and compilation. You can save high-quality vector graphics with advanced features. However, VSD files have some limitations such as they are hard to edit. Therefore, you can convert Visio files to other widely-used file formats such as PDF, PNG, and more. In this blog post, we will use this .NET diagram library to convert Visio to PDF in C# programmatically.
The following points will be covered:
.NET diagram library installation
The VSD to PDF conversion is a matter of a few lines of source code in a .NET application. So, you may download the DLL or install this library by running the following command in the NuGet package manager.
Convert Visio to PDF in C#
Now, you can write a code snippet to achieve the functionality using methods exposed by this .NET diagram library.
The steps are:
- Call the Diagram constructor to load a VSD diagram.
- Instantiate an instance of MemoryStream class to create a stream.
- Save the diagram in PDF format by invoking the save method.
- Create a PDF file by initializing an object of the FileStream class.
- Invoke the WriteTo method that writes the entire contents of this memory stream to another stream.
- Close the streams.
Copy & paste the following code into your main file:
You can see the output in the image below:
VSD to PDF - advanced options
Likewise, you can visit the documentation of this .NET diagram library to know the other cool methods. Moreover, it lets you configure your API calls as per your business requirements.
Get a Free License
You can avail a free temporary license to try the API without evaluation limitations.
We are ending this blog post here with high hopes that you have learned how to convert Visio to PDF in C#. Further, this .NET diagram library provides a huge stack of methods to achieve popular conversions such as VSD to PDF conversion. There are other relevant articles enlisted in the “See Also” section.
Moreover, we suggest you follow our Getting Started guide.
Finally, conholdate.com is writing new blog posts. Therefore, please stay in touch for regular updates.
Ask a question
You can let us know about your questions or queries on our forum.
How do I convert a Visio file to PDF?
Call the Diagram constructor to load a VSD diagram, instantiate an instance of MemoryStream class to create a stream, and save the diagram in PDF format by invoking the save method.