Convert Figma logo to code with AI

TIBCOSoftware logojasperreports

JasperReportsĀ® - Free Java Reporting Library

1,020
395
1,020
44

Top Related Projects

iText for Java represents the next level of SDKs for developers that want to take advantage of the benefits PDF can bring. Equipped with a better document engine, high and low-level programming capabilities and the ability to create, edit and enhance PDF documents, iText can be a boon to nearly every workflow.

1,915

Mirror of Apache POI

A 2D chart library for Java applications (JavaFX, Swing or server-side).

Spring Framework

Quick Overview

JasperReports is an open-source Java reporting library that can be used in a variety of applications, including web applications and rich client applications. It provides the ability to design reports using an XML template, and then generate those reports in a variety of formats, including PDF, HTML, and Excel.

Pros

  • Flexible and Customizable: JasperReports offers a wide range of customization options, allowing developers to create complex and visually appealing reports.
  • Supports Multiple Output Formats: The library can generate reports in various formats, including PDF, HTML, Excel, and more, making it easy to integrate with different systems and applications.
  • Open-Source and Free: JasperReports is an open-source project, which means it is free to use and can be customized to fit specific needs.
  • Large Community and Ecosystem: JasperReports has a large and active community of developers, which means there is a wealth of resources, plugins, and third-party tools available.

Cons

  • Steep Learning Curve: Designing and implementing reports with JasperReports can be complex, especially for developers who are new to the library.
  • Performance Concerns: Generating large or complex reports can be resource-intensive, which can impact the performance of the application.
  • Limited Mobile Support: While JasperReports can generate reports in HTML format, the library's support for mobile devices and responsive design is limited.
  • Vendor Lock-in: Developers who use JasperReports may become dependent on the library, which can make it difficult to switch to alternative reporting solutions in the future.

Code Examples

Here are a few examples of how to use JasperReports in Java:

  1. Generating a Simple Report:
// Load the report template
JasperReport report = JasperCompileManager.compileReport("report.jrxml");

// Create a report parameters map
Map<String, Object> parameters = new HashMap<>();
parameters.put("parameter1", "value1");

// Fill the report with data
JasperPrint print = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());

// Export the report to PDF
JasperExportManager.exportReportToPdfFile(print, "report.pdf");
  1. Passing a SQL Query as the Data Source:
// Load the report template
JasperReport report = JasperCompileManager.compileReport("report.jrxml");

// Create a report parameters map
Map<String, Object> parameters = new HashMap<>();
parameters.put("parameter1", "value1");

// Create a data source using a SQL query
JRDataSource dataSource = new JRResultSetDataSource(executeQuery("SELECT * FROM mytable"));

// Fill the report with data
JasperPrint print = JasperFillManager.fillReport(report, parameters, dataSource);

// Export the report to PDF
JasperExportManager.exportReportToPdfFile(print, "report.pdf");
  1. Embedding a Chart in a Report:
// Create a chart dataset
JRDataSource dataSource = new JRBeanCollectionDataSource(getData());
JRDesignChart chart = new JRDesignChart(new JRBaseChart(JRChart.CHART_TYPE_BAR));
chart.setDataSource(dataSource);

// Add the chart to the report
JRDesignBand band = new JRDesignBand();
band.addElement(chart);
report.setDetailSection(band);

// Fill the report with data and export to PDF
JasperPrint print = JasperFillManager.fillReport(report, parameters, dataSource);
JasperExportManager.exportReportToPdfFile(print, "report.pdf");

Getting Started

To get started with JasperReports, follow these steps:

  1. Install JasperReports: You can download the latest version of JasperReports from the official website (https://community.jaspersoft.com/project/jasperreports-library).

  2. Set up your development environment: Ensure that you have Java and a build tool (e.g., Maven or Gradle) installed on your system.

Competitor Comparisons

iText for Java represents the next level of SDKs for developers that want to take advantage of the benefits PDF can bring. Equipped with a better document engine, high and low-level programming capabilities and the ability to create, edit and enhance PDF documents, iText can be a boon to nearly every workflow.

Pros of itext/itext-java

  • Highly customizable and flexible, allowing for advanced PDF manipulation and creation.
  • Supports a wide range of PDF features, including text, images, tables, and vector graphics.
  • Actively maintained and has a large community of contributors.

Cons of itext/itext-java

  • Steeper learning curve compared to JasperReports, especially for complex PDF layouts.
  • Requires more manual coding to achieve certain PDF features that are more easily accessible in JasperReports.
  • Licensing can be a concern, as the commercial version of iText requires a paid license for certain use cases.

Code Comparison

JasperReports (TIBCOSoftware/jasperreports):

JasperPrint jasperPrint = JasperFillManager.fillReport(
    "report.jasper", parameters, dataSource);
JasperExportManager.exportReportToPdfFile(jasperPrint, "report.pdf");

iText (itext/itext-java):

PdfDocument pdf = new PdfDocument(new PdfWriter("report.pdf"));
Document document = new Document(pdf);
document.add(new Paragraph("Hello, World!"));
document.close();
1,915

Mirror of Apache POI

Pros of Apache POI

  • Apache POI provides a comprehensive set of APIs for working with Microsoft Office file formats, including Excel, Word, PowerPoint, and more.
  • The library is well-documented and has a large community, making it easier to find solutions to common problems.
  • Apache POI is open-source and free to use, making it a cost-effective solution for working with Office documents.

Cons of Apache POI

  • The learning curve for Apache POI can be steeper than some other libraries, as it requires understanding the underlying file formats and APIs.
  • Apache POI may not provide the same level of advanced features and customization options as some commercial reporting tools, such as JasperReports.

Code Comparison

Apache POI (Reading an Excel file)

Workbook workbook = WorkbookFactory.create(new File("example.xlsx"));
Sheet sheet = workbook.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
String value = cell.getStringCellValue();

JasperReports (Generating a report)

JasperReport report = JasperCompileManager.compileReport("report.jrxml");
Map<String, Object> parameters = new HashMap<>();
parameters.put("parameter1", "value1");
JasperPrint print = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(print, "report.pdf");

A 2D chart library for Java applications (JavaFX, Swing or server-side).

Pros of JFreeChart

  • JFreeChart is a mature and well-established library with a large user community and extensive documentation.
  • It provides a wide range of chart types and customization options, making it suitable for a variety of data visualization needs.
  • JFreeChart is open-source and free to use, which can be a significant advantage for projects with limited budgets.

Cons of JFreeChart

  • JFreeChart may have a steeper learning curve compared to some other charting libraries, especially for users who are new to Java development.
  • The library can be resource-intensive, particularly for large or complex charts, which may impact performance in some applications.
  • JFreeChart's licensing model (LGPL) may be a concern for some organizations that have strict requirements around the use of open-source software.

Code Comparison

JFreeChart:

JFreeChart chart = ChartFactory.createLineChart(
    "Line Chart Example",
    "X-Axis",
    "Y-Axis",
    dataset,
    PlotOrientation.VERTICAL,
    true,
    true,
    false
);

JasperReports:

JasperReport report = JasperCompileManager.compileReport("report.jrxml");
JasperPrint print = JasperFillManager.fillReport(report, parameters, dataSource);
JasperExportManager.exportReportToPdfFile(print, "report.pdf");

Spring Framework

Pros of Spring Framework

  • Comprehensive and feature-rich: Spring Framework provides a wide range of features and tools for building enterprise-level applications, including dependency injection, web development, data access, and more.
  • Extensive community and ecosystem: Spring has a large and active community, with a wealth of resources, libraries, and third-party integrations available.
  • Flexibility and modularity: Spring is designed to be modular, allowing developers to pick and choose the components they need for their specific project requirements.

Cons of Spring Framework

  • Steep learning curve: Spring can be complex and may have a steeper learning curve compared to some other frameworks, especially for beginners.
  • Heavyweight: The Spring ecosystem can be quite heavyweight, with a large number of dependencies and a significant footprint, which may not be suitable for all types of projects.

Code Comparison

Spring Framework (Java):

@Configuration
public class MyConfig {
    @Bean
    public MyService myService() {
        return new MyServiceImpl();
    }
}

JasperReports (Java):

JasperPrint jasperPrint = JasperFillManager.fillReport(
    "report.jasper",
    parameters,
    dataSource
);

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

[!IMPORTANT] JasperReports Library 7 released!

The version 7 of the JasperReports Library introduces major refactoring of the project, which is needed for the Jakarta Migration. The changes help improving the dependency management by splitting the library into multiple optional artifacts (*.jar files) depending on the functionality they provide. Deprecated code has been removed and the backward compatibility of serialized/compiled *.jasper report template files has been deliberately broken.

More details about the changes can be found here.

JasperReports Library 7.0.0 Change Log

  • removal of the Ant build system and replacing it with a Maven build system;
  • deprecated code removed;
  • breaking backward compatibility of serialized/compiled *.jasper report template files, mostly because of historical deprecated serialization code removal/cleanup mentioned above (source *.jrxml report templates need to be recompiled to *.jasper using the new version of the library);
  • breaking backward compatibility of source *.jrxml report template files and *.jrtx style template files by replacing the Apache Commons Digester based parsers with Jackson XML object serialization. *.jrxml and *.jrtx files created with version 6 or older can no longer be loaded with version 7 or newer of the library alone. The conversion from the old file formats to the new file formats and back can be made using Jaspersoft Studio 7 and later versions of it;
  • extracting various optional extension JAR artifacts from the the core library JAR artifact to allow the Jakarta Migration of certain of these optional features while also introducing better third party Maven dependency management of these artifacts;
  • some Java package names have changed as a consequence of separating functionality into optional JAR artifacts;
  • upgraded JFreeChart to version 1.5.4 which no longer has support for 3D charts. Reports having Pie 3D, Bar 3D and Stacked Bar 3D charts would continue to work, but will be rendered as 2D, all their 3D effects being ignored;

JasperReportsƂĀ® - Free Java Reporting Library

The JasperReports Library is the world's most popular open source reporting engine. It is entirely 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, MS Word and other.

Documentation:

Older resources:


JaspersoftƂĀ® Studio - report designer for the JasperReports Library

The report templates for the JasperReports Library are XML files which can be edited using a powerful, free to use, Eclipse-based report designer called Jaspersoft Studio. Using Jaspersoft Studio, reports can be built out of any data source and can have their look and feel formatted for printing or on-screen reading, or can be deployed to a JasperReports Server instance, JasperReports IO repository or to a custom application using the JasperReports Library implementation and exported to a wide range of output document formats.

JasperReports Server - reporting and analytics server

JasperReports Server is a stand-alone and embeddable reporting server. It provides reporting and analytics that can be embedded into a web or mobile application as well as operate as a central information hub for the enterprise by delivering mission critical information on a real-time or scheduled basis to the browser, mobile device, or email inbox in a variety of file formats. JasperReports Server is optimized to share, secure, and centrally manage your Jaspersoft reports and analytic views.

JasperReports Web Studio - web-based version of the desktop JaspersoftƂĀ® Studio

JasperReports Web Studio is a new web visual designer that creates and edits report templates for the JasperReportsƂĀ® Library reporting engine and the whole JaspersoftƂĀ® family of products that use the open-source library to produce dynamic content and rich data visualizations.

JasperReports IO - reporting and data visualization in a world of cloud, microservices, and DevOps

JasperReports IO is a RESTful reporting and data visualization service built on JasperReports Library, designed for generating reports and data visualizations in modern software architectures. Just as the JasperReports Library offers a Java API to leverage a powerful and high quality reporting engine inside Java applications, JasperReports IO offers a REST API to leverage the same reporting engine from any other software development platform.

Building the JasperReports Library Project

The JasperReports Library project consists of one core JAR artifact and a number for optional extension JAR artifacts.

The build system relies entirely on the Maven build tool.

Building the core JAR artifact and the optional extension JAR artifacts can be performed from root folder of the project using the following command:

mvn clean install source:jar javadoc:jar

Building the core and extensions JAR artifacts having local non-committed Git modifications requires the suppression of the build number plugin check as follows:

mvn clean install -Dmaven.buildNumber.doCheck=false

From time to time, verifying that the core and extensions artifacts are still compatible with JDK version 1.8 is needed and this is done by turning on the enforcer plugin while building these artifacts:

mvn clean install -Denforcer.skip

The project has a separate artifact for tests under the /tests, which can be run using the following command:

mvn clean test

The project documentation consists of general overview, configuration reference, samples reference, functions reference and the aggregated Javadoc. It can be all generated using the following command in the /docs folder of the project:

mvn clean exec:exec@docs

The generated documentation is to be found under the /docs/target/docs folder of the project.

Running the samples

The project shows and documents many of its features using a set of samples which are themselves Maven projects that can be run from command line. Some of these samples make use of a demo HSQLDB data base that needs to be started before the respective reports are run.

Starting the HSQLDB demo database containing demo data is done using the following command in the /demo/hsqldb folder of the project:

mvn exec:java

The samples are each in a separate subfolder in the /demo/samples folder of the project and can be run either individually or all at once. To run an individual sample, the following command should be run in the respective sample folder:

mvn clean compile exec:java

This exec:java Maven goal is calling the test() method of the sample application main class. Calling individual methods from the sample application main class can be performed using a command like the following:

mvn exec:java -Dexec.args=pdf

which calls the pdf() method of the sample application main class to export the reports to PDF. Multiple methods can be called in sequence like this:

mvn exec:java -Dexec.args="pdf xls"

Viewing the source JRXML report design is done using the following command:

mvn exec:java@viewDesign

The compiled *.jasper report template file can also be viewed using something like:

mvn exec:java@viewDesign -Dexec.args=target/reports/I18nReport.jasper 

The generated *.jrprint report file can be viewed using either:

mvn exec:java@view

or a more explicit command like:

mvn exec:java@view -Dexec.args=target/reports/I18nReport.jrprint

which would also work for XML exported report files:

mvn exec:java@view -Dexec.args=target/reports/I18nReport.jrpxml

Some samples use additional services that need to be started before the actual sample reports are run. To make sure all required steps are performed in right order, an alternate way to run the sample is as follows:

mvn clean compile exec:exec@all

This command is also the one that can be used to run all the samples at once, but it needs to be launched from the /demo/samples folder:

mvn clean compile exec:exec@all