# PrintJob.addPage()

#### Availability

Flash Player 7.

#### Usage

    my_pj.addPage(target [ ,printArea, options, frameNumber])

#### Parameters

target The level or instance name of the movie clip to print. It is untyped and can either be a number, representing the level number (e.g., 0 is root movie), or a string, representing a movie clip name.

printArea The printArea parameter is an object of the following format:

    {xMin:Number, xMax:Number, yMin:Number, yMax:Number}

The printArea is in screen pixels relative to the registration point. (xMax - xMin) must be greater than zero and represents the width. (yMax - yMin) must be greater than zero as well and this represents the height. All four coordinates must be provided.

If the printArea is not provided, then the default is to use the full area of the level or movie clip being printed. That is, if we're printing the root movie, we will use the stage coordinates. If we're printing a movie clip, we will use the full area of the movie clip. In addition, if a bad printArea is provided (e.g., not all coordinates were provided, (xMax - xMin) <=0, etc.), the default printing area is used.

options The options object is optional and currently contains only one setting, printAsBitmap. The correct way to use this options is as follows:

    {printAsBitmap:boolean}

If this parameter is `false` (the default) or omitted, vector printing is assumed. A setting of `true` is a request for bitmap printing.

frameNumber an optional parameter that lets you allows specify which frame to print. If this parameter is omitted, the current frame of the target or level defined in target is printed.

#### Description

PrintJob.addPage() will fail if PrintJob.start() hasn't been called.

The PrintJob api does no scaling. Content as created in the authoring tool should map directly to the same size on the printout. For example, a 72 screen pixel line (which is one inch) onscreen should exactly match a one inch line, or 72 points, on the printed page. You can use the _xscale and/or _yscale movie clip properties to implement scaling.

Please note the following unit equivalencies. Also note that pixel is the most generic onscreen unit, and point is our most generic printout unit. We do not speak of pixels on the page.

1 pixel = 20 twips

1 point = 20 twips

1 inch = 1440 twips

1/72 inch = 1 point = 1 pixel

1 cm = 567 twips

The author's printArea will be positioned in the upper left corner of the printable area on the page, which is represented by pageHeight and pageWidth. That is, the xMin and yMin of the printArea will be set to the 0,0 point of the printable area, described by pageHeight and pageWidth. Note that the printable area is bigger than the area within typical margins.

If the printArea is bigger than the printable area on the page, the printArea will be clipped to the right and the bottom; that is, whatever content overhangs the printable area when printArea is positioned at the upper left corner of the page will be clipped.

Note that the PrintJob api does not observe the #b flags recognized by the old print api to set bounding boxes. printArea is intended to serve as the bounding box.

#### Example

    my_btn.onRelease = function()
    {
    	myPrintJob = new PrintJob();

    	var myResult;

    	myResult = myPrintJob.start();

    	myResult = myPrintJob.addPage(0);
    	myResult = myPrintJob.addPage(0, {xMin:0,xMax:400,yMin:400,yMax:800});
    	myResult = myPrintJob.addPage(0, {xMin:0,xMax:400,yMin:400,yMax:800}, {printAsBitmap:true}, 1);
    	myResult = myPrintJob.addPage(0, {xMin:0,xMax:400,yMin:400,yMax:800}, {printAsBitmap:true});
    	myResult = myPrintJob.addPage(0, {xMin:0,xMax:400,yMin:400,yMax:800}, {printAsBitmap:true}, 1);
    	myResult = myPrintJob.addPage(0, NULL, {printAsBitmap:true}, 1);
    	myResult = myPrintJob.addPage(0, {xMin:0,xMax:400,yMin:400,yMax:800}, NULL, 1);

    	myPrintJob.send();

    	delete myPrintJob;
    }

#### See also