Leon Atherton Leon has over 15 years’ Java experience and leads BuildVu, also contributing to cloud services and internal tooling. Wearing many hats across technical and growth roles as a core member, he enjoys motorsport, strategy games, and software side projects.

How to convert PDF to SVG in C# (Tutorial)

2 min read

pdf to svg with c#

Introduction

This tutorial explains how to convert PDF files to SVG in C# using the hosted BuildVu Cloud API, including examples such as:

Although the above services can be accessed via standard HTTP requests, this tutorial uses our open-source C# IDRCloudClient, which offers an easy-to-use C# wrapper for the REST API.

SVGs for Display in C#

SVG is often better than PDF for C# developers when displaying graphics because SVGs are resolution-independent, always crisp at any size or on any device, and usually much smaller and easier to edit or style programmatically.

SVG can be inserted directly into C# applications, scaled, positioned, and updated in real time, making UI design and visual elements more flexible and responsive.

In contrast, PDFs are better for static document layouts or archiving, but less suited for interactive or dynamic graphic display. SVGs are also less susceptible to attacks because they do not run any code. SVGs can also reduce exploitation potential since they do not include code.

Prerequisites

Install the idrsolutions-csharp-client package via NuGet using the following command:

Code Example

Below is a simple code example demonstrating how to convert PDF files to SVG. Additional configuration options and advanced features are described further down.

Return result to a callback URL

The BuildVu Microservice can accept a callback URL to report the status of a conversion once it is complete. Using a callback URL eliminates the need to poll the service to check when the conversion has finished. You can provide the callback URL to the convert method as shown below.

Configuration Options

The BuildVu API accepts a stringified JSON object with key-value pair configuration options to customize your conversion. These settings should be included in the parameters array. A complete list of configuration options for converting PDF files to SVG is available here.

Upload by URL

In addition to uploading a local file, you can provide a URL for the BuildVu Microservice to download and convert. To do this, replace the input and file values in the parameters variable with the following.

Using Authentication

If your self-hosted BuildVu Microservice requires a username and password to convert PDF files to SVG, you must include them with each conversion request. These credentials are passed as username and password variables to the convert method, as shown below.



BuildVu allows you to

View PDF files in a Web app
Convert PDF documents to HTML5
Parse PDF documents as HTML
Leon Atherton Leon has over 15 years’ Java experience and leads BuildVu, also contributing to cloud services and internal tooling. Wearing many hats across technical and growth roles as a core member, he enjoys motorsport, strategy games, and software side projects.