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
- Syncfusion.Compression.Base.dll
- Syncfusion.HtmlConverter.Base.dll
- Syncfusion.Pdf.Base.dll
- 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