JasperReports is an open source Java reporting tool that can write to screen, to a printer or into PDF, HTML, Microsoft Excel, RTF, ODT, Comma-separated values and XML files. It can be used in Java-enabled applications, including Java EE or Web applications, to generate dynamic content. It reads its instructions from an XML or .jasper file. It is entierly written in Java and it is able to use data coming from any kind of data source and produce pixel-perfect documents that can be viewed, printed or exported in a variety of document formats including HTML, PDF, Excel, OpenOffice and Word.
JasperReports enables users to produce reports of any length and complexity. In fact, its built-in virtualization capability means that only available disk storage resources limit report size. High performance reporting features include:
- Multiple data sources such as JDBC, XML, POJO, EJB, MDX, CSV, and custom
- Output in HTML, PDF, XLS, RTF, SWF, ODF, TXT
- Flash powered reports for interactivity and animation
- Drill down to sub-reports—reports within other reports
- Maps, tables, funnels, crosstabs, charts, barcodes, and many more graphical report components
- Conditional printing and formatting
The Jasper Reports classes and interfaces are used to generate a PDF/Excel report from the catalog.xml file. Add an XML file to the Jasper Reports project with File>New. In the New Gallery frame select General>XML in the Categories listed and XML Document in the Items listed. Specify catalog.xml as the file name in the Create XML File frame. This adds an XML document to the Jasper Reports project.
Jasper Reports reports are defined in an XML file format, called JRXML, which can be hand-coded, generated, or designed using a tool. The file format is defined by a Document Type Definition (DTD), providing limited interoperability. The main difference between using XML and a .jasper file is that the XML file should be compiled at runtime using the JasperCompileManager class.