PrintJob Timeout
I'm trying to load a bunch of external images, and then print them all in the same PrintJob. For testing i tried 40 images at around 599kb.I load all images using Loaders and check that all images are fully loaded (by Event.INIT) and put the images in separate Sprites.
When this is done i start a new PrintJob, loop throug all my images and add them to the PrintJob, and then PrintJob.send();
At least this is what i want to do. What happens is this:
I load the images and store them in Sprites (PrintJob expects Sprites for printing)....
I start my PrintJob and check that it actually starts....
I start adding pages to the PrintJob in a loop that goes through all the Sprites....
**** this is where the problems start ****
Since adding the pages takes some time, normally a few seconds per image, and the PrintJob.send() method takes some time i ALLWAYS exceeed the script timeout limit of (default) 15 seconds. The script stops adding pages and sends the PrintJob(???), resulting in a few correct pages and a few empty pages printed. I've tried EVERYTHING and my conclusion is that printing many, or very large images simply can't be done...
The ActionScript 3.0 documentation says:
Note: ActionScript 3.0 does not restrict a PrintJob object to a single frame (as did previous versions of ActionScript). However, since the operating system displays print status information to the user after the user has clicked the OK button in the Print dialog box, you should call PrintJob.addPage() and PrintJob.send() as soon as possible to send pages to the spooler. A delay reaching the frame containing the PrintJob.send() call will delay the printing process.
Which is ,excuse my language, BULLSHIT! The PrintJob does NOT have scope over multiple frames and HAS to be used in a single frame and is therefore limited to a total of 15 seconds from PrintJob.start() to PrintJob.send(), and this includes the time PrintJob.send() takes to finish.
The only way to get past this is to increase the "Script time limit" to a looooong time, and even that doesn't seem to do much difference.
If anybody would like to prove me wrong, please do! > mikaelnilsson77@hotmail.com
