User Guide
PrintJob.addPage() 393
Returns
A Boolean value: true if the page is successfully sent to the print spooler; false otherwise.
Description
Method; sends the specified level or movie clip as a single page to the print spooler. Before using
this method, you must use
PrintJob.start(); after calling PrintJob.addPage() one or more
times for a print job, you must use
PrintJob.send() to send the spooled pages to the printer.
If this method returns
false (for example, if you haven’t called PrintJob.start() or the user
canceled the print job), any subsequent calls to
PrintJob.addPage() will fail. However, if
previous calls to
PrintJob.addPage() were successful, the concluding PrintJob.send()
command sends the successfully spooled pages to the printer.
If you passed a value for
printArea, the xMin and yMin coordinates map to the upper left corner
(0,0 coordinates) of the printable area on the page. The user’s printable area is described by the
read-only
pageHeight and pageWidth properties set by PrintJob.start(). Because the
printout aligns with the upper left corner of the printable area on the page, the printout is clipped
to the right and/or bottom if the area defined in
printArea is bigger than the printable area on
the page. If you haven’t passed a value for
printArea and the Flex screen is larger than the
printable area, the same type of clipping takes place.
If you want to scale a movie clip before you print it, set its
MovieClip._xscale and
MovieClip._yscale properties before calling this method, and set them back to their original
values afterward. The scale of a movie clip has no relation to
printArea. That is, if you specify
that you print an area that is 50 x 50 pixels in size, 2500 pixels are printed. If you have scaled the
movie clip, the same 2500 pixels are printed, but the movie clip is printed at the scaled size.
The Flash Player printing feature supports PostScript and non-PostScript printers. Non-
PostScript printers convert vectors to bitmaps.
Example
The following example shows several ways to issue the addPage() command:
Note: Some of the code in the following examples includes a value passed for the frameNumber
parameter, which is supported in the Flash authoring environment. When writing Flex applications,
you should omit or pass a value of 0 for this parameter.
my_btn.onRelease = function()
{
var pageCount:Number = 0;
var my_pj:PrintJob = new PrintJob();
if (my_pj.start())
{
// Print entire current frame of the _root movie in vector format
if (my_pj.addPage(0)){
pageCount++;
// Starting at 0,0, print an area 400 pixels wide and 500 pixels high
// of the current frame of the _root movie in vector format
if (my_pj.addPage(0, {xMin:0,xMax:400,yMin:0,yMax:500})){