How to Convert SVG to PDF in C# Code

This step by step tutorial shows you how to convert SVG to PDF in C#. In C# SVG to PDF conversion is easy using Aspose.SVG for .NET and can be achieved with few lines of code.

Steps to Convert SVG to PDF in C# Code

  1. Install Aspose.SVG for .NET package from NuGet.org
  2. Include the four required namespaces to export SVG to PDF in C#
  3. Apply license to Aspose.SVG for .NET to avoid evaluation watermark
  4. Read input SVG file into SVGDocument object
  5. Specify output PDF attributes using PdfRenderingOptions object
  6. Finally, save output PDF by rendering SVG to PdfDevice object

The process of creating a C# converter for SVG to PDF format is very simple if you follow above steps. Between loading an SVG graphics image format and rendering it to an output PDF device object, you can specify the properties of the output PDF file.

Code to Convert SVG to PDF in C#

In the above code, we have set HorizontalResolution, VerticalResolution, and JpegQuality to the default values of 300, 300, and 95 just to give you an idea how to set these attributes in C# SVG to PDF conversion. However, you can change those attribute values as per your requirement.

 English