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

Published: (December 19, 2025 at 04:46 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Introduction

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

  • The IDRsolutions trial version or cloud subscription
  • A self‑hosted BuildVu microservice instance

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

Prerequisites

Install the idrsolutions-csharp-client package via NuGet:

nuget install idrsolutions-csharp-client

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.

using System;
using System.Collections.Generic;
using idrsolutions_csharp_client;

class ExampleUsage
{
    static void Main(string[] args)
    {
        var client = new IDRCloudClient("https://cloud.idrsolutions.com/cloud/" + IDRCloudClient.BUILDVU);

        try
        {
            Dictionary parameters = new Dictionary
            {
                //["token"] = "Token", // Required only when connecting to the IDRsolutions trial and cloud subscription service
                ["input"] = IDRCloudClient.UPLOAD,
                ["file"] = "path/to/input.pdf"
            };

            Dictionary results = client.Convert(parameters);

            string outputUrl = results.GetValueOrDefault("downloadUrl", "No download URL provided");

            client.DownloadResult(results, "path/to/output/dir");

            Console.WriteLine("Converted: " + outputUrl);
        }
        catch (Exception e)
        {
            Console.WriteLine("Conversion failed: " + e.Message);
        }
    }
}

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. Provide the callback URL to the convert method as shown below.

Dictionary parameters = new Dictionary
{
    //["token"] = "Token", // Required only when connecting to the IDRsolutions trial and cloud subscription service
    ["callbackUrl"] = "http://listener.url",
    ["input"] = IDRCloudClient.UPLOAD,
    ["file"] = "path/to/input.pdf"
};

Configuration Options

The BuildVu API accepts a stringified JSON object with key‑value pair configuration options to customize your conversion. Include these settings in the parameters dictionary. A complete list of configuration options for converting PDF files to SVG is available here.

["settings"] = "{\"key\":\"value\",\"key\":\"value\"}"

Upload by URL

Instead of uploading a local file, you can provide a URL for the BuildVu Microservice to download and convert. Replace the input and file entries with the following:

["input"] = IDRCloudClient.DOWNLOAD,
["url"] = "http://exampleURL/exampleFile.pdf"

Using Authentication

If your self‑hosted BuildVu Microservice requires a username and password, include them when creating the client instance:

var client = new IDRCloudClient("http://exampleURL.com/" + IDRCloudClient.BUILDVU, "username", "password");
Back to Blog

Related posts

Read more »