##### Printing reports

There are five methods provided for printing a report.

- printReport()
- printReport(Object printJob, Object pageFormat, boolean bInteractive, boolean bInBackground, boolean bUseJDK11)
- printReport(Object printJob, Object pageFormat, boolean bInteractive, boolean bInBackground, boolean bUseJDK11, boolean bSeparateLargePage)
- printReport(java.lang.Object job, boolean bInteractive, java.lang.Object pf, boolean bInBackground, JReportPrintListener jreportprintlistener, int useJDK, java.lang.String jobName, java.util.Vector attributeInfo, java.lang.String printer)
- getPrintStatus()

Parameters

- bInteractive - A Boolean value. If you set it to false, the Print Setup dialog will not be shown.
- bInBackground - A Boolean value. If you set it to true, the Print dialog will not be shown.
- bUseJDK11 - A Boolean value. If you set it to true, it will use JDK1.1.x to print the report. Otherwise if you set it to false, it will use the JDK that you are running to print the report. The JDK 1.1 printing method is quick in speed but the printing quality cannot be guaranteed. The JDK 1.2 method will provide a satisfactory result, even for a .gif file, but it is slow in speed.
- bSeparateLargePage - A Boolean value. If the report page size is larger than the print paper size, and you want to separate a large report page during printing, you should set this property to true. If the print page size you choose is less than the report page size, the report will be printed in multiple pages serially. This means a large report will be separated automatically. For JDK1.2 or later, after you have set this parameter to true, the Page Format dialog will be shown. In this dialog, you can choose the page format in which you want to print. This page size will then be used for printing. For JDK1.1.x, however, you must first change the page format in the Print dialog (click the Property button, then choose the page format).
- job - The print job of this print action. It is an instance of PrintJob or PrinterJob.
- bUseJDK - An Integer value. If you set it to 0, it will use the method JDK1.1 to print the report. If you set it to 1, it will use the method JDK1.2 to print the report. If you set it to 2, it will use the method JDK1.4 to print the report. The JDK 1.1 printing method is quick in speed but the printing quality cannot be guaranteed. However, the JDK 1.2 method will return you with a satisfactory result, even for a gif file, but it is slow in speed. The method JDK1.4 provides further print options, such as specifying the paper tray.
- attributeInfo - A vector with String elements. Each string has been defined in interface PrintConfig which is located in package jet.bean. For example, you can implement PrintConfig and call its fields as shown below:

  `attributeInfo.add(TRAY_MANUAL);
  attributeInfo.add(ORIENTATION_PORTRAIT).`

Example 1

With JDK1.2 or later, if you use the JDK1.2 printing method (boolean bUseJDK11), you can call the printReport method as shown below:

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

Or, if you do not want to use getPrinterJob, you can simply call:

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

Example 2

With JDK1.2 or later, if you use the JDK1.1 printing method, you are best recommended not to use getPrintJob, instead you can call:

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

Notes:

- The first method printReport() is called to start printing. It will take the third method using default parameter values such as:
  printReport(null, null, true, false, false, false)
- The second and third method allows you to pass the parameters - printJob, pageFormat, bInteractive, bInbackground, bUseJDK11 and bSeparateLargePage.
- The third printing method (with the bSeparateLargePage parameter) is not recommended. It may cause some unexpected errors, for example, you may get an extra blank page.
- After printing has started, the method getPrintStatus() can be used to get the print job status. Returned values of getPrintStatus() are:
  "No print job"
  "Busy"
  "OK"
  "No report load"
  Other error messages if there are errors.