net.sf.jasperreports.engine
Class JasperExportManager

java.lang.Object
  extended by net.sf.jasperreports.engine.JasperExportManager

public final class JasperExportManager
extends java.lang.Object

Fa�ade class for exporting generated reports into more popular formats such as PDF, HTML and XML. This class contains convenience methods for exporting to only these 3 formats.

For exporting to XLS and CSV format or for using special exporter parameters, the specific exporter class should be used directly.

Version:
$Id: JasperExportManager.java 3713 2010-04-08 11:06:05Z teodord $
Author:
Teodor Danciu ([email protected])
See Also:
JasperPrint, JRHtmlExporter, JRPdfExporter, JRXmlExporter, JRXlsExporter, JRCsvExporter

Method Summary
static void exportReportToHtmlFile(JasperPrint jasperPrint, java.lang.String destFileName)
          Exports the generated report object received as parameter into HTML format, placing the result into the second file parameter.
static java.lang.String exportReportToHtmlFile(java.lang.String sourceFileName)
          Exports the generated report file specified by the parameter into HTML format.
static void exportReportToHtmlFile(java.lang.String sourceFileName, java.lang.String destFileName)
          Exports the generated report file specified by the first parameter into HTML format, placing the result into the second file parameter.
static byte[] exportReportToPdf(JasperPrint jasperPrint)
          Exports the generated report object received as parameter into PDF format and returns the binary content as a byte array.
static void exportReportToPdfFile(JasperPrint jasperPrint, java.lang.String destFileName)
          Exports the generated report file specified by the first parameter into PDF format, the result being placed in the second file parameter.
static java.lang.String exportReportToPdfFile(java.lang.String sourceFileName)
          Exports the generated report file specified by the parameter into PDF format.
static void exportReportToPdfFile(java.lang.String sourceFileName, java.lang.String destFileName)
          Exports the generated report file specified by the first parameter into PDF format, the result being placed in the second file parameter.
static void exportReportToPdfStream(java.io.InputStream inputStream, java.io.OutputStream outputStream)
          Exports the generated report read from the supplied input stream into PDF format and writes the results to the output stream specified by the second parameter.
static void exportReportToPdfStream(JasperPrint jasperPrint, java.io.OutputStream outputStream)
          Exports the generated report object received as first parameter into PDF format and writes the results to the output stream specified by the second parameter.
static java.lang.String exportReportToXml(JasperPrint jasperPrint)
          Exports the generated report object supplied as parameter into XML format and returs the result as String.
static void exportReportToXmlFile(JasperPrint jasperPrint, java.lang.String destFileName, boolean isEmbeddingImages)
          Exports the generated report object received as parameter into XML format, placing the result into the second file parameter.
static java.lang.String exportReportToXmlFile(java.lang.String sourceFileName, boolean isEmbeddingImages)
          Exports the generated report file specified by the parameter into XML format.
static void exportReportToXmlFile(java.lang.String sourceFileName, java.lang.String destFileName, boolean isEmbeddingImages)
          Exports the generated report file specified by the first parameter into XML format, placing the result into the second file parameter.
static void exportReportToXmlStream(java.io.InputStream inputStream, java.io.OutputStream outputStream)
          Exports the generated report object read from the supplied input stream into XML format, and writes the result to the output stream specified by the second parameter.
static void exportReportToXmlStream(JasperPrint jasperPrint, java.io.OutputStream outputStream)
          Exports the generated report object supplied as the first parameter into XML format, and writes the result to the output stream specified by the second parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

exportReportToPdfFile

public static java.lang.String exportReportToPdfFile(java.lang.String sourceFileName)
                                              throws JRException
Exports the generated report file specified by the parameter into PDF format. The resulting PDF file has the same name as the report object inside the source file, plus the *.pdf extension and it is located in the same directory as the source file.

Parameters:
sourceFileName - source file containing the generated report
Returns:
resulting PDF file name
Throws:
JRException
See Also:
JRPdfExporter

exportReportToPdfFile

public static void exportReportToPdfFile(java.lang.String sourceFileName,
                                         java.lang.String destFileName)
                                  throws JRException
Exports the generated report file specified by the first parameter into PDF format, the result being placed in the second file parameter.

Parameters:
sourceFileName - source file containing the generated report
destFileName - file name to place the PDF content into
Throws:
JRException
See Also:
JRPdfExporter

exportReportToPdfFile

public static void exportReportToPdfFile(JasperPrint jasperPrint,
                                         java.lang.String destFileName)
                                  throws JRException
Exports the generated report file specified by the first parameter into PDF format, the result being placed in the second file parameter.

Parameters:
jasperPrint - report object to export
destFileName - file name to place the PDF content into
Throws:
JRException
See Also:
JRPdfExporter

exportReportToPdfStream

public static void exportReportToPdfStream(java.io.InputStream inputStream,
                                           java.io.OutputStream outputStream)
                                    throws JRException
Exports the generated report read from the supplied input stream into PDF format and writes the results to the output stream specified by the second parameter.

Parameters:
inputStream - input stream to read the generated report object from
outputStream - output stream to write the resulting PDF content to
Throws:
JRException
See Also:
JRPdfExporter

exportReportToPdfStream

public static void exportReportToPdfStream(JasperPrint jasperPrint,
                                           java.io.OutputStream outputStream)
                                    throws JRException
Exports the generated report object received as first parameter into PDF format and writes the results to the output stream specified by the second parameter.

Parameters:
jasperPrint - report object to export
outputStream - output stream to write the resulting PDF content to
Throws:
JRException
See Also:
JRPdfExporter

exportReportToPdf

public static byte[] exportReportToPdf(JasperPrint jasperPrint)
                                throws JRException
Exports the generated report object received as parameter into PDF format and returns the binary content as a byte array.

Parameters:
jasperPrint - report object to export
Returns:
byte array representing the resulting PDF content
Throws:
JRException
See Also:
JRPdfExporter

exportReportToXmlFile

public static java.lang.String exportReportToXmlFile(java.lang.String sourceFileName,
                                                     boolean isEmbeddingImages)
                                              throws JRException
Exports the generated report file specified by the parameter into XML format. The resulting XML file has the same name as the report object inside the source file, plus the *.jrpxml extension and it is located in the same directory as the source file.

When exporting to XML format, the images can be either embedded in the XML content itself using the Base64 encoder or be referenced as external resources. If not embedded, the images are placed as distinct files inside a directory having the same name as the XML destination file, plus the "_files" suffix.

Parameters:
sourceFileName - source file containing the generated report
isEmbeddingImages - flag that indicates whether the images should be embedded in the XML content itself using the Base64 encoder or be referenced as external resources
Returns:
XML representation of the generated report
Throws:
JRException
See Also:
JRPdfExporter

exportReportToXmlFile

public static void exportReportToXmlFile(java.lang.String sourceFileName,
                                         java.lang.String destFileName,
                                         boolean isEmbeddingImages)
                                  throws JRException
Exports the generated report file specified by the first parameter into XML format, placing the result into the second file parameter.

If not embedded into the XML content itself using the Base64 encoder, the images are placed as distinct files inside a directory having the same name as the XML destination file, plus the "_files" suffix.

Parameters:
sourceFileName - source file containing the generated report
destFileName - file name to place the XML representation into
isEmbeddingImages - flag that indicates whether the images should be embedded in the XML content itself using the Base64 encoder or be referenced as external resources
Throws:
JRException
See Also:
JRPdfExporter

exportReportToXmlFile

public static void exportReportToXmlFile(JasperPrint jasperPrint,
                                         java.lang.String destFileName,
                                         boolean isEmbeddingImages)
                                  throws JRException
Exports the generated report object received as parameter into XML format, placing the result into the second file parameter.

If not embedded into the XML content itself using the Base64 encoder, the images are placed as distinct files inside a directory having the same name as the XML destination file, plus the "_files" suffix.

Parameters:
jasperPrint - report object to export
destFileName - file name to place the XML representation into
isEmbeddingImages - flag that indicates whether the images should be embedded in the XML content itself using the Base64 encoder or be referenced as external resources
Throws:
JRException
See Also:
JRPdfExporter

exportReportToXmlStream

public static void exportReportToXmlStream(java.io.InputStream inputStream,
                                           java.io.OutputStream outputStream)
                                    throws JRException
Exports the generated report object read from the supplied input stream into XML format, and writes the result to the output stream specified by the second parameter. The images are embedded into the XML content itself using the Base64 encoder.

Parameters:
inputStream - input stream to read the generated report object from
outputStream - output stream to write the resulting XML representation to
Throws:
JRException
See Also:
JRPdfExporter

exportReportToXmlStream

public static void exportReportToXmlStream(JasperPrint jasperPrint,
                                           java.io.OutputStream outputStream)
                                    throws JRException
Exports the generated report object supplied as the first parameter into XML format, and writes the result to the output stream specified by the second parameter. The images are embedded into the XML content itself using the Base64 encoder.

Parameters:
jasperPrint - report object to export
outputStream - output stream to write the resulting XML representation to
Throws:
JRException
See Also:
JRPdfExporter

exportReportToXml

public static java.lang.String exportReportToXml(JasperPrint jasperPrint)
                                          throws JRException
Exports the generated report object supplied as parameter into XML format and returs the result as String. The images are embedded into the XML content itself using the Base64 encoder.

Parameters:
jasperPrint - report object to export
Returns:
XML representation of the generated report
Throws:
JRException
See Also:
JRPdfExporter

exportReportToHtmlFile

public static java.lang.String exportReportToHtmlFile(java.lang.String sourceFileName)
                                               throws JRException
Exports the generated report file specified by the parameter into HTML format. The resulting HTML file has the same name as the report object inside the source file, plus the *.html extension and it is located in the same directory as the source file. The images are placed as distinct files inside a directory having the same name as the HTML destination file, plus the "_files" suffix.

Parameters:
sourceFileName - source file containing the generated report
Returns:
resulting HTML file name
Throws:
JRException
See Also:
JRHtmlExporter

exportReportToHtmlFile

public static void exportReportToHtmlFile(java.lang.String sourceFileName,
                                          java.lang.String destFileName)
                                   throws JRException
Exports the generated report file specified by the first parameter into HTML format, placing the result into the second file parameter.

The images are placed as distinct files inside a directory having the same name as the HTML destination file, plus the "_files" suffix.

Parameters:
sourceFileName - source file containing the generated report
destFileName - file name to place the HTML content into
Throws:
JRException
See Also:
JRPdfExporter

exportReportToHtmlFile

public static void exportReportToHtmlFile(JasperPrint jasperPrint,
                                          java.lang.String destFileName)
                                   throws JRException
Exports the generated report object received as parameter into HTML format, placing the result into the second file parameter.

The images are placed as distinct files inside a directory having the same name as the HTML destination file, plus the "_files" suffix.

Parameters:
jasperPrint - report object to export
destFileName - file name to place the HTML content into
Throws:
JRException
See Also:
JRPdfExporter


Copyright © 2011. All Rights Reserved.