This is an archived forum post. The information may be outdated. Contact us if you have any questions.

PDFCROWD BUG: Javascript not Displayed properly

bernparent wrote on 2014-05-10:
When making a pdf out of some webpages where there's lots of math as here:

http://www.bernardparent.com/viewtopic.php?f=17&t=257&start=20

Sometimes when I convert this page, the javascript mathjax is cut short resulting in some math not being converted properly. Sometimes it works, sometimes it doesn't.

Could you change your algorithm so that it waits for all javascript to be executed before sending out the pdf?
support wrote on 2014-05-12:
Hello,

The service uses some heuristics to decide the moment when to terminate JavaScript executed after the onload event is fired. This is because, unlike the browser, it cannot wait indefinitely and has to start printing the page to PDF at some moment. The heuristics mostly works, but there are cases when the script is aborted prematurely and which may result into incomplete PDF. The typical causes are an ajax call taking too long or use of the setTimeout()/setInterval() functions.

It often helps to do as much work as possible before or right after the onload event is fired. Javascript code executed before the onload event should never be aborted prematurely.