Articles in this section
Category / Section

How to convert SVG into PDF document?

1 min read

The SVG file can be converted to PDF using WebKit HTML Converter. Please find the code example and sample below for the same.

 

Assemblies Required

  1. Syncfusion.Compression.Base.dll
  2. Syncfusion.HtmlConverter.Base.dll
  3. Syncfusion.Pdf.Base.dll
  4. QtBinaries folder

All the above-mentioned assemblies can be get by installing the WebKit installer available in the below link.

WebKit HTML Converter: https://www.syncfusion.com/downloads/latest-version

 

//Initialize HTML to PDF converter 
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
 
WebKitConverterSettings settings = new WebKitConverterSettings();
 
//Set WebKit path
settings.WebKitPath = @"../../QtBinaries/";
 
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
 
//Convert a SVG file to PDF with HTML converter
PdfDocument document = htmlConverter.Convert(@"../../Sample.svg");
 
//Save and close the PDF document 
document.Save("Output.pdf");
 
document.Close(true);
 

 

Working Sample can be downloaded from the below link.

https://www.syncfusion.com/downloads/support/directtrac/general/ze/SVGToPDF1792257340

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied