##### Printing reports

The following methods are provided for printing reports:

- 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(Object printJob, Object pageFormat, boolean bInteractive, boolean bInBackground,
  boolean bUseJDK11, boolean bSeparateLargePage, String jobName)
- printReport (Object printJob, Object pageFormat, boolean bInteractive, boolean bInBackground,
  boolean bUseJDK11, boolean bSeparateLargePage, String jobName, String printer)
- 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

- printJob - The job of this printing.
- pageFormat - Description of the size and orientation of a page that is to be printed.
- 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, JDK1.1.x will be used to print the report. Otherwise, if you set false, the JDK that you are currently running will be used 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 give you 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 chosen is less than the report page size, the report will then be printed in multiple pages serially. This means that a large page of a report will automatically be separated. After you set this parameter to true, for JDK1.2 or later, the Page Format dialog will be displayed. In this dialog, you can choose the page format for printing. However, for JDK1.1.x, you will have to change the page format with which you want to print in the Print dialog (click the Property button, and then choose page format).
- jobName - A String value of the job name. When printing, the defined job name will be listed in the window, which can show the information such as the status and owner of a document.
- printer - The name of the printer used to print the report. Note that if you set bUseJDK11 to false, you will not be able to set the printer, and instead will be required to use the default printer.
- 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, the method JDK1.1 will be used to print the report. If you set it to 1, the method JDK1.2 will be used to print the report. If you set it to 2, the method JDK1.4 will be used 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 satisfactory result, even for a .gif file. But it is slow in speed. JDK 1.4 provides further options, such as specifying the paper tray.
- attributeInfo - A vector where the elements are String.

  Each String has been defined in interface PrintConfig. Interface PrintConfig is located in package jet.bean. For example, you can implement PrintConfig and call its fields as below:

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

Notes:

- The first method printReport() is called to start the print. It will then 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 is started, the method getPrintStatus() can be used to show the print job status. Returned values of getPrintStatus() are:
  "No print job"
  "Busy"
  "OK"
  "No report load"
  Other error messages if there are errors.

Examples

- Example 1

  Under 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 getPrinterJob, simply call:
      bean.printReport(null, null, false, false, false);

- Example 2

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

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

- Example 3

  Under JDK 1.2 or later, if you use the JDK1.1 printing method and select a network printer, you can call the printReport method as shown below:

  `bean.printReport(null, null, false, false, true, false, "job1", "\\\\GUOF\\HP LaserJet 6L Pro PCL5e");`

- Example 4

  Under JDK 1.2 or later, if you use the JDK1.1 printing method and select a local printer, you can call the printReport method as shown below:

  `bean.printReport(null, null, false, false, true, false, "job1", "HP LaserJet 6L Pro PCL5e");`