2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
The Syncfusion HTML to PDF for .NET is used for converting webpages, SVG, MHTML, and HTML to PDF. Using this library, you can avoid text and image splitting across the PDF pages while converting HTML to PDF. Steps to avoid text and image splitting on HTML to PDF conversion:
C# //Initialize the HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); //Initialize WebKitConverterSetttings WebKitConverterSettings settings = new WebKitConverterSettings(); //Set WebKit path settings.WebKitPath = @"/QtBinaries/"; //Set the SplitTextLines property settings.SplitTextLines = false; //Set the SplitImages property settings.SplitImages = false; //Assign WebKit settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("input.html"); //Save and close the PDF document document.Save("Output.pdf"); document.Close(true);
Screenshot of the SplitTextLines and SplitImages property enabled document
Screenshot of the SplitTextLines and SplitImages property disabled document A complete working sample can be downloaded from the HTMLtoPDF_Sample.zip Take a moment to peruse the documentation for Converting HTML to PDF. You will find various options for URL to PDF, HTML string to PDF, and hyperlinks. Refer to here to explore the rich set of Syncfusion Essential PDF features. An online sample link for Converting HTML to PDF.
|
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.