Search code examples
actionscript-3apache-flexpdftimeoutpurepdf

Flex ScriptTimeLimit 15 Seconds


I have a flex project where people can style something (add pictures, forms, text, ...) and create a PDF in the end. I'm using the purepdf library to create the PDF. My problem is, that when I create the PDF there is one point where the PDF library needs more than the default 15 seconds script time to create the page.

I always get the following error message: Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.

I tried to add scriptTimeLimit="60" and also add -default-script-limits 1000 60 to the compiler options, but it's still at the default 15 seconds.

I already tried to break up the creation of the PDF in different chunks, but that's as small as I can go. Can anyone help me to extend the default script time?

Thanks guys!


Solution

  • Thanks for your help! You're right, we shouldn't leave the app hanging for that long. I finally found a solution with the help of an ActionScript Worker. I handed the whole PDF creation over to a worker and showed an animated loading bar. As it turns out Workers aren't affected by the execution time limit and can handle exhaustive tasks.

    Thanks for pointing me in the right direction!