We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

HTML to PDF with WebKit Converter: Is it possible to wait for the document to be ready?

Hello,

We want to convert on-the-fly a page from a site in our project to a PDF document when prompted by a user online (to make a more brochure like walking guide in this instance, see attachment). Unfortunately the pages can take some time to finish (part of the page comes from Google Maps).

In the Webkit Converter Settings I have the following:

converterSettings.AdditionalDelay = 15000;
However, this can be somewhat hit & miss. Is it at all possible to wait for a change in the state of the Html document, something like the jQuery $(document).ready?

Thank you

Paul Herzberg


Attachment: Walking_example_b77c117a.zip

3 Replies

PV Prakash Viswanathan Syncfusion Team September 20, 2016 03:16 PM UTC

Hi Michael Koelbl, 

Thank you for contacting syncfusion support.  

Our HTML to PDF converter could not automatically detect with the document ready state. However, we can achieve this manually by using window.status. We have already implemented a support for HTML converter to hook on the window.status, once it is set to completed the loading stops and start converting to PDF. 
How to use it: 
1)      In the HTML document change the window.status to completed once HTML is loaded. 
2)      For Google maps, please check can you trigger an event once the maps are loaded and set the window.status as completed
3)      When the window.status is changed to completed, HTML converter will stop loading the HTML and process for PDF conversion. 

I have attached simple Window status sample and input HTML for your reference.  

Please let us know if you need any further assistance on this. 

Regards, 
Prakash V. 



MK Michael Koelbl October 25, 2016 07:12 AM UTC

Hello,

Thank you for the solution it does work as described.

One small thing, though, if the HTML document never sets the window.status then the converter never stops. Is there a way to prevent this in the converter?

Or do I need to put the conversion in, say, a thread that will timeout?

Thank you


PV Prakash Viswanathan Syncfusion Team October 26, 2016 12:49 PM UTC

Hi Michael Koelbl, 
 
Thank you for your update. 
 
At present we do not support for conversion timeout in our HTML to PDF WebKit converter. 
 
If the windows status value is assigned, our converter will wait until the windows status get satisfied. This is our default behavior. 
 
Please let me know if you need any further assistance 
 
Regards, 
Prakash V. 


Loader.
Live Chat Icon For mobile
Up arrow icon