How to Convert SVG to PDF using C#

This brief topic walks you through detailed steps on how to convert SVG to PDF using C# along with information about configuring the environment to execute the code. By using C# SVG to PDF converter can be easily developed using a simple API interface in .NET supported platforms based applications.

Steps to Convert SVG to PDF using C#

  1. Using NuGet package manager, include Aspose.Imaging to convert SVG to PDF
  2. Import the reference to Aspose.Imaging namespace in your application
  3. Load the source SVG file using Image.Load method
  4. Instantiate SvgRasterizationOptions class object to set the SVG image height and width
  5. Create PdfOptions class to set the desired PDF options
  6. Convert SVG to PDF using the Save method

The above steps in C# convert SVG to PDF with the help of simple API calls and a few lines of code. The process will commence by loading the source SVG image using Load() method, which is followed by setting SVG page width and height using SvgRasterizationOptions class. Finally, using PdfOptions class, PDF rasterization options will be set and SVG will be converted to PDF.

Code to Convert SVG to PDF using C#

In the above example, SVG to PDF C# based converter application has been developed using a few lines of code. The API allows you to customize the exported PDF by setting the page size, image resolution, multi-page options, and PDF document information with the help of PdfOptions class.

The aforementioned example entails that in order to Convert SVG to PDF C# based simple converter can be easily developed with no dependence on any external third-party software like Adobe Acrobat. If you want to learn about converting SVG to a PNG image using C#, refer to the article on how to convert SVG to a PNG using C#.

 English