2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
Converting HTML to PDF in Web application from scratch using WebKit HTML converter. This documentation contains three sections:
Assemblies Required
You can get all these assemblies by installing the WebKit installer in the following link. WebKit HTML Converter: https://www.syncfusion.com/downloadslatest-version HTML to PDF conversion in local machine
C# public ActionResult ExportToPDF() { //Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); WebKitConverterSettings settings = new WebKitConverterSettings(); //Set WebKit path settings.WebKitPath = Server.MapPath("~/QtBinaries/"); //Assign WebKit settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert(Request.Url.Authority); MemoryStream stream = new MemoryStream(); //Save and return the PDF file document.Save(stream); return File(stream.ToArray(), System.Net.Mime.MediaTypeNames.Application.Pdf, "Sample.pdf"); }
Publishing the project to server
Troubleshooting the conversion failure in server Refer to the following links for troubleshooting the conversion failure in the server. UG: https://help.syncfusion.com/file-formats/pdf/converting-html-to-pdf#troubleshooting Sample: |
2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.