Support for long-running AJAX requests?

9,435 views
Skip to first unread message

Steve

unread,
Mar 17, 2014, 3:13:39 PM3/17/14
to wkhtmltop...@googlegroups.com
I'm trying to render a page that populates a table via a long-running AJAX request.

The page renders, but without the results of the query...I just get an empty table.

I know there's the "--javascript-delay" option, but that presupposes knowledge of how long the query is going to take...

Is there a mechanism by which I could block wkhtmltopdf until all of the AJAX data is loaded?

Thanks,
Steve

This e-mail message is intended for the named recipient(s) above, and may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please do not read the content. Instead, immediately notify the sender and delete this e-mail message. Any unauthorized use, disclosure or distribution is strictly prohibited. Quantify Labs Inc and the sender assume no responsibility for any errors, omissions, or readers' misinterpretations and/ or understanding of the content or transmission of this email.

Jakob Truelsen

unread,
Mar 17, 2014, 3:25:46 PM3/17/14
to wkhtmltop...@googlegroups.com
In general there is no way to know when ajax is done (it requires
solving the halting problem), however if you control the page loaded,
you can run
"window.status = 'myrandomstring';" in javascript whenever you feel
you are done loading. And then run wkhtmltopdf eq with
"--javascript-delay 100000 --window-status myrandomstring"
This will cause wkhtmltopdf to output the pdf as the document looks
after 100 seconds, or when window.status is set to myrandomstring
whatever comes first.

/Jakob
> --
> ===================================================
> You received this message because you are subscribed to the "wkhtmltopdf
> General" group.
> To post to this group, send email to wkhtmltop...@googlegroups.com
> To unsubscribe from this group, send email to
> wkhtmltopdf-gen...@googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/group/wkhtmltopdf-general?hl=en?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "wkhtmltopdf General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to wkhtmltopdf-gen...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Steve

unread,
Mar 18, 2014, 10:19:23 AM3/18/14
to wkhtmltop...@googlegroups.com
--window-status is perfect.

Thanks for pointing it out.

Cheers,
Steve
>
> For more options, visit this group at
> http://groups.google.com/group/wkhtmltopdf-general?hl=en?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "wkhtmltopdf General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages