com.crystaldecisions.sdk.occa.report.application
Class PrintOutputController

java.lang.Object
  extended by com.crystaldecisions.sdk.occa.report.application.PrintOutputController

public class PrintOutputController
extends java.lang.Object

This object is used to export reports to a specific format, such as Microsoft Excel (97-2003), Rich Text Format (RTF), or PDF and to modify various formatting options. It is also used to print a report with RAS SDK server-side printing.


Method Summary
static IExportOptions createDefaultExportOptions(ReportExportFormat format)
          Creates default IExportFormatOptions based on the given ReportExportFormat
 java.io.InputStream export(IExportOptions exportOptions)
           Exports this document to the specified format with options.
 java.io.InputStream export(IExportOptions exportOptions, IRequestContext requestContext)
           Exports the specified context of this document to the specified format with options.
 void export(IExportOptions exportOptions, IRequestContext requestContext, java.io.OutputStream os)
           Exports the specified context of this document as the specified format, with the specified options and to the passed OutputStream.
 java.io.InputStream export(ReportExportFormat format)
           Exports this document to the specified format.
 void export(ReportExportFormat format, java.io.OutputStream os)
           Exports this document as the specified format and to the passed OutputStream.
 java.util.List findAvailableMediaTrays(java.lang.String printerName)
           Gets the list of available java MediaTrays for a give printer name.
 IPrintOptions getPrintOptions()
           Gets the print options.
 void modifyPageMargins(int left, int right, int top, int bottom)
           Modifies the appropriate properties in the PageMargins object.
 void modifyPaperOrientation(PaperOrientation orientation)
           Modifies the paper orientation.
 void modifyPrinterName(java.lang.String printerName)
           Modifies the printer name.
 void modifyPrintOptions(IPrintOptions printOptions)
           Modifies the print options.
 void modifyUserPaperSize(int height, int width)
           Modifies the custom paper size
 void printReport(java.awt.print.PrinterJob job, java.util.List<IRequestContext> contexts)
           Prints a report to a specified printer that is controlled by RAS SDK server-side printing.
 void printReport(PrintReportOptions printReportOptions)
           Prints a report to a specified printer that is controlled by RAS SDK server-side printing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

export

public java.io.InputStream export(ReportExportFormat format)
                           throws ReportSDKException

Exports this document to the specified format.

Parameters:
format - A ReportExportFormat object that specifies the export format of the report.
Returns:
An InputStream object containing the report document exported to the specified format.
Throws:
ReportSDKException

export

public java.io.InputStream export(IExportOptions exportOptions)
                           throws ReportSDKException

Exports this document to the specified format with options.

Parameters:
exportOptions - The export options that can be specified in the IExportOptions object.
Returns:
An InputStream object containing the report document exported to the specified format.
Throws:
ReportSDKException
See Also:
IExportOptions

export

public java.io.InputStream export(IExportOptions exportOptions,
                                  IRequestContext requestContext)
                           throws ReportSDKException

Exports the specified context of this document to the specified format with options.

Parameters:
exportOptions - The export options that can be specified in the IExportOptions object.
requestContext - The request context specifying the drill path and/or subreport to export; null for the main report
Returns:
An InputStream object containing the report document exported to the specified format.
Throws:
ReportSDKException
See Also:
IExportOptions

export

public void export(ReportExportFormat format,
                   java.io.OutputStream os)
            throws ReportSDKException

Exports this document as the specified format and to the passed OutputStream.

Parameters:
format - A ReportExportFormat object that specifies the export format of the report.
os - the OutputStream to export to
Throws:
ReportSDKException

export

public void export(IExportOptions exportOptions,
                   IRequestContext requestContext,
                   java.io.OutputStream os)
            throws ReportSDKException

Exports the specified context of this document as the specified format, with the specified options and to the passed OutputStream.

Parameters:
exportOptions - The export options that can be specified in the IExportOptions object.
requestContext - The request context specifying the drill path and/or subreport to export; null for the main report
os - the OutputStream to export to
Throws:
ReportSDKException
See Also:
IExportOptions

createDefaultExportOptions

public static IExportOptions createDefaultExportOptions(ReportExportFormat format)
Creates default IExportFormatOptions based on the given ReportExportFormat

Parameters:
format - the format to get the default options for

getPrintOptions

public IPrintOptions getPrintOptions()
                              throws ReportSDKException

Gets the print options.

Returns:
a reference to the IPrintOptions object
Throws:
ReportSDKException

modifyPrintOptions

public void modifyPrintOptions(IPrintOptions printOptions)
                        throws ReportSDKException

Modifies the print options.

Note: As of the Report Application Server 12 SDK, the PrintOutputController.modifyPageMargins method must be used to set all page margins to the default value 0. Attempts to set all page margins to 0 using the PrintOutputController.modifyPrintOptions method are ignored.

Example:

This sample shows how to set the print options for a report with the PrintOutputController. The PrintOutputController enables you to export reports to a specific format, such as Excel, RTF, or PDF, and to modify various formatting options.

 PrintOutputController printOutputController = clientDoc.getPrintOutputController();
 IPrintOptions printOptions = printOutputController.getPrintOptions();
 IPrintOptions newPrintOptions = (PrintOptions)((PrintOptions)printOptions).clone(true);
 newPrintOptions.setPaperSize(PaperSize.paperLegal);
 newPrintOptions.setPaperOrientation(PaperOrientation.landscape);
 printOutputController.modifyPrintOptions(newPrintOptions);
 

Parameters:
printOptions - the IPrintOptions object to be modified
Throws:
ReportSDKException

modifyPageMargins

public void modifyPageMargins(int left,
                              int right,
                              int top,
                              int bottom)
                       throws ReportSDKException

Modifies the appropriate properties in the PageMargins object. All properties modified in this method are measured in twips.

Parameters:
left - the left margin of the report
right - the right margin of the report. Absolute, not relative to the left property.
top - the top margin of the report
bottom - the bottom margin of the report. Absolute, not relative to the top property.
Throws:
ReportSDKException

modifyUserPaperSize

public void modifyUserPaperSize(int height,
                                int width)
                         throws ReportSDKException

Modifies the custom paper size

Parameters:
height - the height of the paper. This value must be greater than the distance between the vertical margins.
width - the width of the paper. This value must be greater than the distance between the horizontal margins.
Throws:
ReportSDKException

modifyPrinterName

public void modifyPrinterName(java.lang.String printerName)
                       throws ReportSDKException

Modifies the printer name.

Parameters:
printerName - the name of the printer to be modified
Throws:
ReportSDKException

modifyPaperOrientation

public void modifyPaperOrientation(PaperOrientation orientation)
                            throws ReportSDKException

Modifies the paper orientation.

Parameters:
orientation - the PaperOrientation object to be modified
Throws:
ReportSDKException

findAvailableMediaTrays

public java.util.List findAvailableMediaTrays(java.lang.String printerName)
                                       throws ReportSDKPrinterException

Gets the list of available java MediaTrays for a give printer name.

Parameters:
printerName - name of the printer.
Returns:
A list of MediaTray objects. Returns null if the printer cannot be found.
Throws:
ReportSDKPrinterException

printReport

public void printReport(java.awt.print.PrinterJob job,
                        java.util.List<IRequestContext> contexts)
                 throws ReportSDKPrinterException,
                        java.util.concurrent.CancellationException

Prints a report to a specified printer that is controlled by RAS SDK server-side printing.

Parameters:
job - the PrinterJob to use to print the report.
contexts - the list of contexts to print, null to print the top-level report path
Throws:
java.util.concurrent.CancellationException - if the print job was cancelled
ReportSDKPrinterException

printReport

public void printReport(PrintReportOptions printReportOptions)
                 throws ReportSDKPrinterException

Prints a report to a specified printer that is controlled by RAS SDK server-side printing.

Parameters:
printReportOptions - the PrintReportOptions of the report to be printed by RAS SDK server-side printing
Throws:
java.util.concurrent.CancellationException - if the print job was cancelled
ReportSDKPrinterException