Convert SVG to PDF XPS C#

Scalable Vector Graphics, SVG, file format is used to display two-dimensional images, usually in for the web. You can convert SVG to PDF or XPS programmatically using C# or VB.NET. XPS and PDF file formats are widely supported and utilized by different systems. In this article, we will be covering the SVG to PDF and SVG to XPS conversion features with examples.

SVG to PDF or XPS Converter – API Installation

Aspose.SVG for .NET is a dedicated product to edit, manipulate, or convert SVG files. We have designed it while considering a huge number of feature requests from the users. You can easily install the API by using NuGet from the Tools menu in Microsoft Visual Studio IDE. This approach can be helpful in the way that all dependencies are automatically installed with the single installation command. For instance, SVG rendering might also need System.Drawing reference which is not often available by default, in non-windows environments. Moreover, you can also download the API from the official website.

Convert SVG to PDF Programmatically in C#

You can convert SVG to PDF files in your .NET based applications whether that is a console, web, desktop, or any other application. The best part of the conversion is the high fidelity among input SVG and output PDF documents. Moreover, the efficient utilization of resources by the API results in the quick conversion of files. You need to follow the following steps below for converting SVG files to PDF:

  1. Load input SVG file.
  2. Specify PdfRenderingOptions object.
  3. Set Page Setup properties including page size, margin, etc.
  4. Render SVG to PDF file with C#.

The code snippet explains how to convert SVG file to PDF programmatically using C#:

Convert SVG to XPS Programmatically in C#

You can easily convert SVG files to XPS using simple API calls without worrying about the in-depth details of the file formats. You should follow the simple steps below to perform the conversion:

  1. Load input SVG file.
  2. Initialize XPSRenderingOptions object.
  3. Set PDF page size, margins, etc.
  4. Render SVG to XPS file with C#.

The following code shows how to convert SVG to XPS Programmatically using C#:

Download Examples Project and Sample Files

We have compiled a sample project as a demonstration application for SVG to PDF or XPS file format conversion using C# programming language. It gives you a quick overview of everything we have discussed above. You can download the ZIP file of the project, or clone it from GitHub Repository as per your convenience.

Conclusion

In this article, we have explored how to convert SVG files to PDF or XPS format files programmatically using C# or VB.NET languages in your .NET Framework-based applications. There are a lot more features offered by the API to work with SVG files. You can explore further by visiting the Documentation and API References. In case of any concerns, you can always reach out to us at Free Support Forum.

See Also