Recently, we published a blog post on how to convert Visio to SVG programmatically. In this blog post, you will learn how to convert PDF to SVG in C# using this image generator API. PDF to SVG conversion is a lightweight process when you do it using this enterprise-level .NET library. Moreover, you can build more beyond a basic PDF to SVG converter programmatically. Before going ahead, make sure you have installed .NET on your local machine.
In this blog post, the following sections will be covered:
- Image generator API installation
- How to convert PDF to SVG in C#
- PDF to SVG converter - advanced options
Image generator API installation
Well, you may configure the library by downloading the DLL files or install it by running the following command in the NuGet package manager.
How to convert PDF to SVG in C#
Now, you can build a PDF to SVG converter by writing a couple of lines of source code in a .NET application.
The steps are:
- Create an instance of the Document class and load the source PDF file.
- Invoke the Save method to save the file in SVG format.
Copy & paste the following code into your main file:
The output can be seen in the image below:
PDF to SVG converter - advanced options
Likewise, you can configure your API calls to meet your business requirements and you can specify certain options during PDF to SVG conversion.
Please follow the steps given below:
- Initialize an object of the Document class and load the source PDF file.
- Initializes a new instance of ImageSaveOptions class that can be used to save rendered images in the SVG format.
- Set the PageSet property to “0” to convert only the first page of a document.
- Change the image’s brightness by setting the value of the ImageBrightness property.
- Set the value of the ImageContrast property to modify the contrast of the image.
- Change the horizontal resolution by setting the value of the HorizontalResolution property.
- Call the Save method to save the SVG file.
Get a Free License
You can avail a free temporary license to try the API without evaluation limitations.
We are ending this blog post at this point. Hopefully, you have learned how to convert PDF to SVG in C# programmatically. In addition, you have gone through some advanced options for this image generator API. This guide will help you if you are willing to build a PDF to SVG converter for your business application. Finally, do not forget to visit the documentation to know about other great methods.
Moreover, we suggest you follow our Getting Started guide.
Finally, conholdate.com is writing new blog posts. So, please stay in touch for regular updates.
Ask a question
You can let us know about your questions or queries on our forum.
Can I convert a PDF to an SVG?
Create an instance of the Document class and load the source PDF file, and invoke the Save method to save the file in SVG format.