User Guide

Setting size, scale, and orientation 493
Setting size, scale, and orientation
The section “Printing a page” on page 488 details the steps for a basic print job, where the
output directly reflects the printed equivalent of the screen size and position of the specified
sprite. However, printers use different resolutions for printing, and can have settings that
adversely affect the appearance of the printed sprite.
Flash Player can read an operating systems printing settings, but note that these properties are
read-only: although you can respond to their values, you cant set them. So, for example, you
can find out the printer’s page size setting and adjust your content to fit the size. You can also
determine a printer’s margin settings and page orientation. To respond to the printer settings,
you may need to specify a print area, adjust for the difference between a screens resolution
and a printer’s point measurements, or transform your content to meet the size or orientation
settings of the users printer.
Using rectangles for the print area
The PrintJob.addPage() method allows you to specify the region of a sprite that you want
printed. The second parameter,
printArea, is in the form of a Rectangle object. You have
three options for providing a value for this parameter:
Create a Rectangle object with specific properties and then use that rectangle in the
addPage() call, as in the following example:
private var rect1:Rectangle = new Rectangle(0,0,400,200);
myPrintJob.addPage(sheet, rect1);
If you havent already specified a Rectangle object, you can do it within the call itself, as in
the following example:
myPrintJob.addPage(sheet, new Rectangle(0, 0, 100, 100));
If you plan to provide values for the third parameter in the addPage() call, but dont want
to specify a rectangle, you can use
null for the second parameter, as in the following;
myPrintJob.addPage(sheet, null, options);
NOTE
If you plan to specify a rectangle for the printing dimensions, remember to import the
flash.display.Rectangle class.