Printing a report

There are four methods for printing a report:

And one method for obtaining the status of a report:

The first method printReport() is called to start printing. It will call the last method and use the default parameter values such as: printReport(null, null, true, false, false, false)

The second and third methods allow you to pass the parameters - printJob, pageFormat, bInteractive, bInbackground, bUseJDK11 and bSeparateLargePage. Below is an explanation of each parameter:

Example1

Under JDK 1.2 or later version, if you use the JDK 1.2 printing method (boolean bUseJDK11), you can call the printReport method as follows:

PrinterJob printJob = PrinterJob.getPrinterJob();
bean.printReport(printJob, printJob.defaultPage(), false, false, false);

Or, if you do not want to get PrinterJob, simply call:

bean.printReport (null, null, false, false, false);

Example2

Under JDK 1.2 or higher, if you use JDK 1.1 printing method, you are best recommended not to get PrintJob, just call:

bean.printReport (null, null, false, false, true);

After the print process has started, the method getPrintStatus ( ) can be used to obtain the print job status. The returned values of getPrintStatus ( ) are: