2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
We can manually wait HtmlConverter up to the document loading using WindowStatus property in WebKit HTML converter. We can use windows status instead of addition delay. In additional delay, we do not know the exact time that need for execution of JavaScript. By windows status you can avoid this problem. Note: Both window status should be same, else converter never stops the conversion Assemblies Required
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 C# // Create a HTML to PDF converter object with default settings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitpath webKitSettings.WebKitPath = @"../../../../QtBinaries"; //Set window status webKitSettings.WindowStatus = "completed"; htmlConverter.ConverterSettings = webKitSettings; //Convert url to pdf PdfDocument document = htmlConverter.Convert("input.html"); //Save the document. document.Save("Sample.pdf");
Input.html <html> <head> </head> <body > <div id="message"> Wait for 2 Seconds </div> <script type="text/javascript"> setTimeout(function () { document.getElementById("message").innerHTML = "Hello World!!"; window.status = "completed"; }, 2000); </script> </body> </html>
Working Sample can be downloaded from the below link. http://www.syncfusion.com/downloads/support/directtrac/general/ze/WindowStatus1964014437
|
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.