PrintJob constructor

public PrintJob()

Creates a PrintJob object that you can use to print one or more pages.

To implement a print job, use the following methods in sequence. You must place all commands relating to a specific print job in the same frame, from the constructor through PrintJob.send() and delete. Replace the [params] to the my_pj.addPage() method calls with your custom parameters.

// create PrintJob object
var my_pj:PrintJob = new PrintJob();

// display print dialog box, but only initiate the print job
// if start returns successfully.
if (my_pj.start()) {

    // use a variable to track successful calls to addPage
    var pagesToPrint:Number = 0;

    // add specified area to print job
    // repeat once for each page to be printed
    if (my_pj.addPage([params])) {
    pagesToPrint++;
    }
    if (my_pj.addPage([params])) {
    pagesToPrint++;
    }
    if (my_pj.addPage([params])) {
    pagesToPrint++;
    }

    // send pages from the spooler to the printer, but only if one or more
    // calls to addPage() was successful. You should always check for successful 
    // calls to start() and addPage() before calling send().
    if (pagesToPrint > 0) {
    my_pj.send();  // print page(s)
    }
}

// clean up
delete my_pj;  // delete object

You cannot create a second PrintJob object while the first one is still active. You cannot create a second PrintJob object (by calling new PrintJob()) while the first PrintJob object is still active, the second PrintJob object will not be created.

Availability: ActionScript 1.0; Flash Player 7

Example

See PrintJob.addPage().

See also

addPage (PrintJob.addPage method), send (PrintJob.send method), start (PrintJob.start method)