User Guide
492 Printing
Setting vector or bitmap rendering
You can manually set the print job to spool each page as vector graphics or a bitmap image. In
some cases, vector printing will produce a smaller spool file, and a better image than bitmap
printing. However, if your content includes a bitmap image, and you want to preserve any
alpha transparency or color effects, you should print the page as a bitmap image. Also, a non-
PostScript printer automatically converts any vector graphics to bitmap images. You specify
bitmap printing in the third parameter of
PrintJob.addPage(), by passing a
PrintJobOptions object with the
printAsBitmap parameter set to true, as follows:
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = true;
myPrintJob.addPage(mySprite, null, options);
If you don’t specify a value for the third parameter, the print job will use the default, which is
vector printing.
Timing print job statements
ActionScript 3.0 does not restrict a PrintJob object to a single frame (as did previous versions
of ActionScript). However, because the operating system displays print status information to
the user once 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.
Because ActionScript 2.0 does have a single-frame restriction, any print job statements in
ActionScript 2.0 are restricted to 15 seconds before hitting the script time-out limit. In
ActionScript 3.0, this script time-out limit still applies. Therefore, the time between each
major statement in a print job sequence cannot exceed 15 seconds. In other words, the 15-
second script time-out limit applies to the following intervals:
■ Between PrintJob.start() and the first PrintJob.addPage()
■ Between PrintJob.addPage() and the next PrintJob.addPage()
■ Between the last PrintJob.addPage() and PrintJob.send()
If any of these intervals spans more than 15 seconds, the next call to
PrintJob.start() on
the PrintJob instance returns
false, and the next PrintJob.addPage() on the PrintJob
instance causes Flash Player to throw a run-time exception.
NOTE
If you don't want to specify a value for printArea (the second parameter) but want to
specify a value for bitmap printing, use
null for printArea.