Convert SVG to PDF in C#

IronPDF has extensive support for rendering SVG graphics into PDF documents via the "html to pdf" methodology.

Please note that it is important to set the width and / or height style attribute of the img element when embedding an SVG - otherwise it may collapse to zero size and not appear in the rendered PDF.

C# NuGet Library for PDF

Install with NuGet

Install-Package IronPdf

Download DLL

Download DLL

Manually install into your project

Render SVG to PDF Example

Many browsers are tolerant of SVGs having no size, however our rendering engine is sensitive to this.

using IronPdf;

string html = "<img src='' style='width:100px'>";

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf(html);
Imports IronPdf

Private html As String = "<img src='' style='width:100px'>"

Private renderer As New ChromePdfRenderer()

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(html)
VB   C#

Output PDF

Additionally or alternatively an SVG node may have an explicit width and height attribute assigned. Please also see these excellent SVG styling examples on CodePen: