PrintJob 1029
Example
The following example shows how you might use the value of the orientation property to
adjust the printout:
// create PrintJob object
var my_pj:PrintJob = new PrintJob();
// display print dialog box
if (my_pj.start()) {
// boolean to track whether addPage succeeded, change this to a counter
// if more than one call to addPage is possible
var pageAdded:Boolean = false;
// check the user's printer orientation setting
// and add appropriate print area to print job
if (my_pj.orientation == "portrait") {
// Here, the printArea measurements are appropriate for an 8.5" x 11"
// portrait page.
pageAdded = my_pj.addPage(this,{xMin:0,xMax:600,yMin:0,yMax:800});
}
else {
// my_pj.orientation is "landscape".
// Now, the printArea measurements are appropriate for an 11" x 8.5"
// landscape page.
pageAdded = my_pj.addPage(this,{xMin:0,xMax:750,yMin:0,yMax:600});
}
// send pages from the spooler to the printer
if (pageAdded) {
my_pj.send();
}
}
// clean up
delete my_pj;
See also
addPage (PrintJob.addPage method)
,
send (PrintJob.send method)
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...