Welcome to the JasperReports IO Demo App
This is the sample web application that demonstrates the capabilities of the JasperReports IO reporting service.
The JasperReports IO (JRIO) is an HTTP based service which exposes its report generating functionality through a REST API.
The reporting service inside JRIO is based on the functionality of the JasperReports Library (JRL). JRIO acts like a REST API wrapper on top of the reporting Java API of the JRL.
In this demo application, you'll find sample reports and examples showing how to embed the reporting service into your own application.
The JRIO service can be deployed in various ways, ranging from monolithic web application, with all its specialized sub-services placed together in the same application (good for testing and small scale deployments), to container based deployments in the Cloud, where specialized sub-services run in separate containers and are able to scale independently while working together to deliver a single embeddable reporting service (suited for large scale deployments).
Quick Start Guide
For more detailed documentation, see the TIBCO JasperReports IO User Guide.
You see this demo application because you have already installed and launched one of the JasperReports IO distributions, which provides this demo application as a convenience, to help you getting started with the product.
Installation
There are several types of distributions available for JRIO and you have probably used one of the following:
- JasperReports IO Professional
Archive containing a standalone web application server in which the JRIO service is deployed as a web application together with a demo web application and the sample repository.
Configuration
You have probably launched the JRIO reporting service using the default configuration it came with in the distribution you have used.
Below is a list of some of the configuration settings you can change, to improve your experience with the product or to customize it to your needs.
Web Application Server (JRIO Professional)
JRIO start command on Linux:
./jre/bin/java -Xms256m -Xmx512m -jar ./jetty/start.jar
jetty.base=./jrio --start
-Djetty.http.port=8080 -DSTOP.PORT=8989 -DSTOP.KEY=st0p_J3Tty
JRIO start command on Windows:
jre\bin\java -Xms256m -Xmx512m -jar jetty\start.jar
jetty.base=jrio --start
-Djetty.http.port=8080 -DSTOP.PORT=8989 -DSTOP.KEY=st0p_J3Tty
JRIO start command on macOS:
./jre/Contents/Home/bin/java -Xms256m -Xmx512m -jar ./jetty/start.jar
jetty.base=./jrio --start
-Djetty.http.port=8080 -DSTOP.PORT=8989 -DSTOP.KEY=st0p_J3Tty
Setting cache size to 4000 objects, to match 4Gb of heap memory:
<local-cache name="virt" configuration="virtPassivation">
<memory>
<object size="4000" />
</memory>
</local-cache>
With JasperReports IO Professional, the JRIO reporting service is delivered by a Java web application deployed in an Eclipse Jetty server instance shipped inside the JRIO distribution package.
In the JRIO Professional binary archive distributions, there are two scripts placed in the root folder of the archives, which help you start and stop the Eclipse Jetty server and thus the JRIO reporting service deployed inside it.
The start script contains the command which starts the Eclipse Jetty server and it specifies several startup configuration parameters that can be changed to better suit your particular environment and needs.
Java Heap Memory
There are two command line arguments for specifying the amount of heap memory allocated to the Java Virtual Machine:
-Xms256m -Xmx512m
Most of the heap memory allocated to the JVM is used to cache report execution related objects. When increasing the size of the allocated heap memory, it is recommended that the maximum number of objects that can be cached by the reporting application to be increased proportionally, to thus make use of the additional memory. This settings is controlled by the objectsizeproperty of the local-cache entry namedvirt, of thevirtPassivationconfiguration found in the[JRIO_WEB_APP]/WEB-INF/infinispan.xmlfile. A good practice is to match this size property to the number of megabytes of heap memory allocated to the JVM.Jetty Port
By default, the Jetty server starts on port8080, but in case this port is already used on your target machine, you can change it to some other available port number:
-Djetty.http.port=8080Jetty Stop Port and Key
The last two settings are needed by the stop script. If you change them in the start script, make sure you also change them in the stop script:
-DSTOP.PORT=8989 -DSTOP.KEY=st0p_J3Tty
For more details about how to further configure Eclipse Jetty server at startup, please consult the Jetty documentation.
Repository
The report samples presented in this demo application are delivered by the JRIO reporting service using report templates, sample report data and other required resources found in a file based repository which is part of the same JRIO distribution you are currently using.
The type of repository, its location and other specific repository implementation properties can be specified in a Spring configuration file.
In the JasperReports IO Professional distribution package, this configuration file is found at:
[JRIO_WEB_APP]/WEB-INF/applicationContext-repository.xml
Repository location relative to Web application real path:
<bean class="com.jaspersoft.jrio.common.repository.WebappRelativeRepositoryFactory">
<property name="jasperReportsContext" ref="baseJasperReportsContext"/>
<property name="root" value="../../../repository"/>
</bean>
- Repository folder relative to Webapp folder
In the JasperReports IO Professional distributions, the file based repository containing the sample reports used by this demo application is placed under the/repositoryfolder of the extracted archive.
Since this repository folder is located relative to the folder where the JRIO web application is deployed, we are using a special repository implementation (WebappRelativeRepositoryFactory) which is able to locate the real path on disk for the web application at runtime, and then moves up 3 folders to reach the JRIO installation folder, from where the repository folder is found.
Absolute path repository location:
<bean class="com.jaspersoft.jrio.common.repository.FileSystemRepository">
<constructor-arg><ref bean="baseJasperReportsContext"/></constructor-arg>
<constructor-arg><value>/mnt/jrio-repository</value></constructor-arg>
</bean>
- Repository folder absolute path
There is another file based repository implementation available in the product, for specifying the absolute path on disk for the repository folder (FileSystemRepository). You could use it to point JRIO to some other repository of your own, or to add a new repository to the existing ones.
AWS S3 bucket repository:
<bean class="com.jaspersoft.jrio.common.repository.s3.S3RepositoryService">
<property name="jasperReportsContext" ref="baseJasperReportsContext"/>
<property name="s3Service">
<bean class="com.jaspersoft.jrio.common.repository.s3.S3ServiceFactory">
<property name="region" value="us-east-1"/>
<!--
<property name="accessKey" value="put-id-here"/>
<property name="secretKey" value="put-key-here"/>
-->
</bean>
</property>
<property name="bucketName" value="jrio-repo-sample"/>
<property name="pathPrefix" value="jrio-repository/"/>
</bean>
- AWS S3 bucket repository
The product comes also with a built-in repository implementation (S3RepositoryService) which allows connecting to an AWS S3 bucket as repository for report resources. The bucket can be public, accessed without credentials, as it is the case with one such bucket we use in this demo, or can be accessed securely, using AWS credentials.
Report Execution Contexts
The JRIO repository is a folder based structure where the report templates and other report related resources are stored and from where they are retrieved when reports are executed by the JRIO reporting service.
The main entry point into the report execution process is the master report template (source *.jrxml file or
compiled *.jasper file), which is specified using its absolute path within the repository folder structure
(its extension being optional), and which in turn can reference other resources from the repository during
the report execution.
Since the JRIO reporting service leverages the reporting functionality of the JasperReports Library, you can learn more about how to create report templates and how to deploy them in the repository by following the JasperReports Library documentation.
For example, a report having its main template file at the following location within the repository:
/samples/reports/chartcustomizers/ChartCustomizersReport.jrxml
has its report execution context configured using the following file:
/samples/reports/chartcustomizers/JR_INF/context.xml
Notice that the
ChartCustomizersReport.jrxmlfile and theJR-INFfolder have the same parent folder.
When a report is executed by JRIO, it is executed into a so called report execution context. Each report has such context defined by the classpath it uses when it is run and by the configuration properties which are set in this context and tailor the behavior of the reporting engine.
The report execution context for a report is configured using a context.xml file placed in a folder called JR-INF,
which has the same parent as the report's main template file.
If multiple report templates are found in the same folder, they share the same context found in
the JR-INF subfolder that accompanies them.
This means that one way to make sure a report template has its own report execution context that it does
not share with any other report, is to isolate this report template into its own subfolder,
where a JR-INF folder would define a report execution only for this single report present there.
Report Execution Context Inheritance
Report execution contexts inherit from one another and this inheritance can be controlled.
For example, the report execution context defined at:
/samples/reports/chartcustomizers/JR_INF/
inherits from both the:
/samples/reports/JR-INF/
context and the:
/samples/JR-INF/
context, if the respective
JR-INFfolders and theircontext.xmlare present (JR-INFfolders are optional).
- Folder Inheritance (Default)
By default, any report execution context defined by aJR-INFfolder somewhere in the repository, inherits from the contexts defined by theJR-INFfolders found in the parent folders up towards the root folder of the repository.
For example, if we want the report execution context at:
/samples/reports/chartcustomizers/JR-INF/context.xml
to inherit from a sibling context at:
/samples/reports/unicode/JR-INF/context.xml
instead of the default parent folder inheritance, we need to add this to the
context.xml:
<context>
<parentContext>
<path>/samples/reports/unicode</path>
</parentContext>
...
</context>
- Direct Inheritance
The default inheritance mechanism which follows repository structure can be disabled and replaced by direct parent context reference within thecontext.xmlfile using the<parentContext>tag as follows:
<context>
<parentContext>
<path>/parent</path>
</parentContext>
...
</context>
The path to the parent context needs to specify the absolute repository path of the parent folder
containing the target JR-INF context that we want to use as parent context.
Notice that the path does not contain the JR-INF folder, just the parent folder of that target
report execution context.
Report Execution Context Classpath
For example, the report having its main template file at:
/samples/reports/chartcustomizers/ChartCustomizersReport.jrxml
uses custom Java code packaged in the
JARfile at:
/samples/reports/chartcustomizers/JR_INF/lib/repo-sample.jar
by referencing it in the
context.xmlfile at:
/samples/reports/chartcustomizers/JR_INF/context.xml
as follows:
<context>
<classpath>
<entry><path>samples/reports/chartcustomizers/JR-INF/lib/repo-sample.jar</path></entry>
</classpath>
...
</context>
As a Java reporting library, JasperReports has various extension points which allow the customization
of its functionality using custom code in the form of compiled Java classes.
These classes are among the various types of resources that a report might need at execution time and
they can also be stored in the repository, along with the subreports, style templates, images, fonts
and other report resources.
Since the Java classes containing the custom functionality need to be loaded by the Java Virtual Machine when a particular report is executed, they need to be referenced in a special way by the reports that use them.
The custom Java classes needed during a certain report execution need to be packaged as JAR files
and placed in the repository, preferably under the JR-INF/lib subfolder of the target report execution context.
The JAR then needs to be referenced from within the target JR-INF/context.xml file using a pair of
<entry><path> tags in the <classpath> tag, so that it will be loaded as part of the dynamic Java
classpath used by the reporting service when running reports in this report execution context.
Report Execution Context Configuration Properties
Example of setting the chart render type configuration property in a
JR-INF/context.xmlfile:
<context>
...
<properties>
<property>
<name>net.sf.jasperreports.chart.render.type</name>
<value>svg</value>
</property>
...
</properties>
</context>
The JasperReports Library has many configuration settings that allow tailoring its behavior to specific needs.
Some of these configuration settings can be set at report context execution level using configuration properties specified
in the JR-INF/contex.xml file using <property> tags.
More details about the configuration settings available for use in report executions contexts, please check the JasperReports Configuration Reference.
Security
The JasperReports Library which provides the reporting functionality behind the JasperReports IO service, allows reports to call Java code through report expressions during the report execution. While this is a powerful feature of the reporting engine, which gives great flexibility to users to further customize their reports and be able to support complex reporting requirements, it can also be a security vulnerability in case the people deploying the report templates in the JRIO repository are not to be trusted.
For instance, calls for disk access and calls to System.Exit can be hidden in the report classpath.
The previous section of this guide explains how report classpath is configured and controlled by the users
who have access to repository content.
Protection Domain
Security policy file with the default permissions:
grant codeBase "file:${java.home}/lib/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${java.home}/lib/ext/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${user.dir}/jetty/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${user.dir}/jrio/webapps/-" {
permission java.security.AllPermission;
};
//permissions for JRIO repository jars
grant codeBase "file:/__jrio/repository/jars/" {
//permission java.security.AllPermission;
};
//permissions for JR reports
grant codeBase "file:/__jrio/repository/reports/" {
};
An effective measure against such intrusions is to implement a protection domain. The ProtectionDomain class encloses
a group of classes whose instances have the same permissions, public keys, and URI. A given class can belong to only
one ProtectionDomain. For more information on ProtectionDomain, see the
Java documentation.
JRIO has preconfigured protection domain that by default gives all permissions to:
- classes from the Java Virtual Machine distribution
- classes from the Jetty server distribution
- classes from the web applications that make up the JRIO reporting service
At the same time, this preconfigured protection domain does not give any permission to:
- classes from the repository JARs
- classes which evaluate the report expressions
This default configuration offers a reasonable restrictive security environment which can then be customized to the actual security needs of your specific JRIO deployment.
Security Manager
Although JRIO is shipped with this preconfigured protection domain as explained above, the security infrastructure is not activated by default. For activating the protection domain support, the Java security manager needs to be specified when launching the Jetty server. This is done by providing two Java configuration properties when starting the Java Virtual Machine from command line:
-Djava.security.manager -Djava.security.policy=jrio/security.policy
The JRIO startup scripts have these configurations present but commented out. Simply uncommenting the respective lines in the scripts would be enough to activate the Java security infrastructure and its preconfigured protection domain on JRIO service startup.
Customizing Permissions
When activating the security manager for the Java Virtual Machine using the above mentioned configuration properties,
a security policy file is specified (jrio/security.policy).
This file stores the permissions for each defined protection domain and it can be altered to better suit the specific
security needs of the current JRIO deployment.
More details about the syntax of this policy file and what permissions are available can be found in the Java Security documentation.
Server Side Rendering
In the JRIO distributions where Chrome is not configured to be used by default for server side rendering, the following property needs to be set in the
[JRIO_WEB_APP]/WEB-INF/classes/jasperreports.propertiesto make use of Chrome instead of PhantomsJS or SlimerJS:
net.sf.jasperreports.chrome.enabled=true
In case the service was not able to find Chrome on the local machine in the usual locations, the following property needs to be set in the
[JRIO_WEB_APP]/WEB-INF/classes/jasperreports.propertiesfile to point to the location of the Chrome browser executable:
net.sf.jasperreports.chrome.executable.path=/path/to/chrome
The following property needs to be set in the
[JRIO_WEB_APP]/WEB-INF/classes/jasperreports.propertiesfile to point to either the PhantomJS or the SlimerJS executable, which is expected to be found on the same machine where the JRIO service runs:
net.sf.jasperreports.phantomjs.executable.path=/path/to/phantomjs_or_slimerjs
The reports generated by the JRIO service can sometimes have visualizations and graphics that are produced by Javascript and other Web-based drawing libraries
(see Charts Pro and Custom Visualizations).
These work out-of-the-box when the reports are displayed in HTML format and are viewed in the Web browser.
However, when these reports are exported to PDF and other non-HTML document formats, the Web-based visualizations need to be rendered as images on the server side,
where their inclusion in the exported documents occurs.
For rendering Web visualizations as images, the JRIO service needs a headless browser on the server side so that it can basically make snapshots of these visualizations off-screen. This headless browser functionality is offered by several third party products, and JRIO does not ship any of these in its distribution. They have to be installed separately and the JRIO needs to be configured to make use of them.
JRIO can be configured to work with either Chrome, PhantomJS or SlimerJS for server side rendering of Web visualizations during non-HTML exports of the reports.
In the JRIO Professional distributions, Chrome takes precedence over PhantomJS and SlimerJS, being configured to be used by default. The JRIO service will try to find a Chrome installation on the machine where it runs and use it automatically. If not found, it will fall back to using PhantomJS or SlimerJS.
These two products (PhantomJS and SlimerJS) are interchangeable as they expose the same public API and work the same way, as far as JRIO is concerned. This is why the same configuration property can be used for both. But they are now considered deprecated in JRIO and their use is no longer recommended as both products are no longer maintained by their authors.
REST API Reference
The JasperReports IO REST API is an Application Programming Interface that follows the guidelines of REpresentational State Transfer design to allow client application to interact with the server through the HTTP protocol.
For OpenAPI 3.0 (Swagger) style documentation, see the JasperReports IO REST API in the Swagger UI, where you can actually test it against a live instance of the service.
Javascript API Samples
Basic Embed
Initialization of the jrio.js library with simple rendering of an HTML report.
Try it: Simple report rendering,
from a list
Use a common configuration to load multiple reports.
Try it: Load multiple reports
Pagination
Try it: Next/previous
Report Parameters
Pass a simple set of hard-coded parameters to control report output. This can be expanded with custom input controls such as a drop-down.
Try it: Parameter passing,
basic drop-down
Hyperlinks
Select a report hyperlink to open a new "drill-down" report with selected parameter.
Try it: Basic drill-down,
open report in a new page
Bookmarks
Click on the bookmarks to navigate to the page and anchor they point to.
Try it: Bookmarks
Report content search
Search the report content for specific words or phrases.
Try it: Search
Events
Listen through events for a change in the page totals and report completed status.
Try it: Page totals,
reports status
UI Controls
Dynamically control UI elements for table columns.
Try it: Table column sorting order,
table column conditional formatting
Export
Custom export options with various formats.
Try it: Export formats
Report Gallery
This section presents a series of sample reports that are meant to show some of the basic reporting capabilities of the JasperReports Library, which are available through the REST API exposed by JRIO.
Data Grouping
This is a fairly complex report which displays customer orders grouped by country, in a list format that runs on two columns per page, from top to bottom and then from left to right. The report connects to a demo database through a JDBC data adapter and retrieves the orders by executing an SQL query found in the report template. The report also performs various group, column and page level calculations and displays the values formatted using special format patterns.
Tables
The following reports show how the built-in table component can be used and configured to produce interactive output in which table columns can be selected to open up a pop-up menu with options to format, hide, filter or sort the values.
The first table report uses a CSV data adapter (CsvDataAdapter.xml) to retrieve person information, including addresses.
Data is grouped by city field, which is displayed once in the table group header. Clicking on the city name will open
another report containing a map centered on that city coordinates.
The table group footer displays the record count for the current city.
This second table report displays customer orders from a demo database table, which are grouped by city and filtered on a parameter
called city using a contains characters criteria. It signals if the shipped freight quantity is either above or below a certain
threshold specified by the optional freight parameter using either green or red arrows pointing up or down, respectively.
The third table report uses an XML data adapter (northwindData.xml) to retrieve the customers data from the northwind.xml file,
which will be displayed in a table component.
Orders for each customer are read from the same data file and get collected in a subreport that uses a table component as well.
Crosstabs
This report connects to a demo database using a JDBC data adapter and retrieves customer orders using an SQL query
that is stored in the report template itself.
It then processes the customer orders and aggregates the information into a crosstab which displays the number of orders
and the latest order date grouped by country on rows and by freight range on columns.
This second crosstab report uses the same customer order data, but aggregates orders freight by region
and city on rows and by year and month on columns.
Besides showing multi level grouping on both rows and columns, it also shows how a crosstab breaks and wraps
when its width is larger than the page width.
Charts (Static)
The following reports connect to a demo database through a JDBC data adapter and retrieve orders data by performing an SQL query,
also stored in the report template.
Then they process the orders and aggregate the information to be displayed into various chart types, rendered with the
JFreeChart library. The available data is grouped by both
country and by country's name first letter.
![]()
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/charts/AreaChartReport
Repository URI :/samples/reports/charts/BarChartReport
Repository URI :/samples/reports/charts/Bar3DChartReport
Repository URI :/samples/reports/charts/BubbleChartReport
Repository URI :/samples/reports/charts/CandlestickChartReport
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/charts/GanttChartReport
Repository URI :/samples/reports/charts/HighLowChartReport
Repository URI :/samples/reports/charts/LineChartReport
Repository URI :/samples/reports/charts/MeterChartReport
![]()
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/charts/MultipleAxisChartReport
Repository URI :/samples/reports/charts/PieChartReport
Repository URI :/samples/reports/charts/Pie3DChartReport
Repository URI :/samples/reports/charts/ScatterChartReport
Repository URI :/samples/reports/charts/StackedAreaChartReport
![]()
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/charts/StackedBarChartReport
Repository URI :/samples/reports/charts/StackedBar3DChartReport
Repository URI :/samples/reports/charts/ThermometerChartReport
Repository URI :/samples/reports/charts/TimeSeriesChartReport
Repository URI :/samples/reports/charts/XYAreaChartReport
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/charts/XYBarChartReport
Repository URI :/samples/reports/charts/XYBarChartTimePeriodReport
Repository URI :/samples/reports/charts/XYBarChartTimeSeriesReport
Repository URI :/samples/reports/charts/XYLineChartReport
Chart Types
| Area | Try it: VIEW PDF XLSX |
|
| Bar | Try it: VIEW PDF XLSX |
|
| Bar 3D | Try it: VIEW PDF XLSX |
|
| Bubble | Try it: VIEW PDF XLSX |
|
| Candlestick | Try it: VIEW PDF XLSX |
|
| Gantt | Try it: VIEW PDF XLSX |
|
| High Low | Try it: VIEW PDF XLSX |
|
| Line | Try it: VIEW PDF XLSX |
|
| Meter | Try it: VIEW PDF XLSX |
|
| Multiple Axis | Try it: VIEW PDF XLSX |
|
| Pie | Try it: VIEW PDF XLSX |
|
| Pie 3D | Try it: VIEW PDF XLSX |
|
| Scatter | Try it: VIEW PDF XLSX |
|
| Stacked Area | Try it: VIEW PDF XLSX |
|
| Stacked Bar | Try it: VIEW PDF XLSX |
|
| Stacked Bar 3D | Try it: VIEW PDF XLSX |
|
| Thermometer | Try it: VIEW PDF XLSX |
|
| Time Series | Try it: VIEW PDF XLSX |
|
| XY Area | Try it: VIEW PDF XLSX |
|
| XY Bar | Try it: VIEW PDF XLSX |
|
| XY Bar Time Period | Try it: VIEW PDF XLSX |
|
| XY Bar Time Series | Try it: VIEW PDF XLSX |
|
| XY Line | Try it: VIEW PDF XLSX |
Chart Themes
![]()
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/chartthemes/ChartThemesReport
![]()
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/chartthemes/ChartThemesReport
This report retrieves sales data from various CSV data files, based on report subdatasets that use CSV data adapters.
The sales data is then processed and aggregated to be displayed into various chart types, rendered with the
JFreeChart library.
All charts in the report share the same chart theme who's name can be passed in as chartTheme report parameter.
| Eye Candy Sixties | Try it: VIEW PDF XLSX |
|
| Aegean | Try it: VIEW PDF XLSX |
Chart Customizers
![]()
![]()
Repository URI :/samples/reports/chartcustomizers/ChartCustomizersReport
This report uses report subdatasets to retrieve sales data from two CSV data files (category.csv and xy.csv) based on built-in CSV data adapters.
Then the data is processed and aggregated to be displayed into a customized bar chart / XY line chart, based on specific chart customizer classes.
The customized bar chart displays star-like legend shapes and a category marker placed on a given category (sally).
The customized XY line chart displays step lines with no shapes.
Charts Pro (Interactive)
![]()
![]()
![]()
Repository URI :/samples/reports/highcharts/HighchartsChart
The HighchartsChart report connects to a CSV data file through a CSV data adapter to retrieve customer orders data.
This data is then processed and aggregated to be displayed into various chart types, rendered with the
Highcharts library. The orders are filtered by country name and grouped by regions.
The report presents two interactive charts: pie and multiaxis. Tooltips appear when mouse comes over a given region
in the pie chart or over a given point or bar in the multiaxis chart.
One can change the chart type by clicking on the Chart Types... button displayed near each chart.
A dialog will open with available chart types and we can then select the desired type.
The related chart will change automatically to the new type.
Images
This report shows how various image types (JPEG, GIF, SVG, PNG, TIFF) can be embedded into a report. Images are collected from different locations, including the local file system and network URLs. The scaleImage attribute is used to adjust/clip the image size within its container. Some of the images provide hyperlinks.
Barcodes
The Barcode4JReport shows how barcode images generated either with the Barcode4J library or with the Google zxing library (for the QRCode component) can be embedded into a report.
The BarbecueReport shows how barcode images generated with the Barbecue library
can be embedded into a report.
Maps
The Google Map report (MapReport) shows how Google maps can be embedded into a report, based on the built-in Google map component. Both markers and paths are supported by this component. The main report connects to an empty data adapter with 5 records, and 5 different map components are loaded as subreports into detail sections. In order to configure maps, markers and paths data are supplied through report subdatasets using CSV data adapters (MapCsvDataAdapter.xml, PathLocationDataAdapter.xml, PathStyleDataAdapter.xml) to connect to data files.
Internationalization
The UnicodeReport shows how Unicode characters can be rendered into a report. It uses either the \uXXXX unicode character notation or the character itself, since the JRXML file encoding is set by default to "UTF-8". In order to properly represent these characters, the report makes use of 3 font libraries added as font extensions: DejaVu, Arphic and Google Noto.
The internationalized I18nReport illustrates how resource bundle files can be used to render the same report in different languages. In order to do so, it sets the resourceBundle attribute with the appropriate path value for the resource bundle files location: resourceBundle="/samples/reports/i18n/i18n". To render a i18n text, the report uses the $R{} syntax. It can be rendered in the following languages:
| German | Try it: VIEW PDF XLSX |
|
| English | Try it: VIEW PDF XLSX |
|
| French | Try it: VIEW PDF XLSX |
|
| Portuguese | Try it: VIEW PDF XLSX |
|
| Romanian | Try it: VIEW PDF XLSX |
Styled Text
The MarkupReport shows how various types of styled text can be used in report, by setting the markup attribute of the element with one of the following values:
none- text is interpreted as plain text, with no local style attributesstyled- text is considered as marked with JasperReports styled text featureshtml- text is interpreted as HTML markuprtf- text is interpreted as RTF markup
Hyperlinks
This report shows how hyperlinks of different types, such as:
LocalAnchorLocalPageReferenceRemoteAnchor
can be configured and used within a report.
Report Books
The following reports are based on report parts, used instead of bands inside report sections. A report part is somehow similar to a subreport, but pages generated from a part are directly included within the generated report, and not embedded into the pages of the parent report. One of the main advantages of using a report part is that each part may have its own page layout settings, therefore the generated document can consist in sections with different page layout and L&F settings. Also, table of contents sections can be easily generated, based on available local anchor elements and bookmark levels set in the report.
The BookReport report is made of 3 report parts: Table of Contents, Overview and Shipments. It connects to a demo database through a JDBC data adapter and retrieves data by performing a SQL query stored in the report template. The Overview and Shipments parts use the same connection to retrieve their data.
The Table of Contents section is generated using the net.sf.jasperreports.bookmarks.data.source.parameter property, which tells about the bookmarks datasource object. In our case the property value is set to "REPORT_DATA_SOURCE", instructing the JR engine that report bookmarks should be used directly to populate the bookmark datasource.
The Overview part processes the customer orders collected from the demo database and aggregates the information into a crosstab which displays the number of orders and the latest order date grouped by country on rows and by freight range on columns. The page layout orientation for this section is set as Landscape.
The Shipments part is placed in the detail section of the report, so it will be loaded once per each distinct country in the report datasource. For a given country orders data are grouped by city and represented in the form of both a pie chart and a table. The page layout orientation for this section is set back as Portrait.
![]()
![]()
Repository URI :/samples/reports/tableofcontents/TableOfContentsReport
The TableOfContentsReport is made of 2 report parts: Table of Contents and Countries. It connects to a demo database through a JDBC data adapter to retrieve the total number of orders. The Countries part uses the same connection to retrieve orders. Data is then grouped by the first letter of the country name and further by the county name. It is displayed in a table-like structure.
To be generated, the Table of Contents section needs a bookmark datasource, characterized by 3 fields:
- level - used to indent entries in the TOC
- label - the bookmark label
- pageIndex - the temporary page index where the bookmark is anchored in
When the net.sf.jasperreports.bookmarks.data.source.parameter property is set to "REPORT_DATA_SOURCE", this tells the JR engine that report bookmarks should be used to populate the bookmark datasource.
One can see in the Table of Contents section country names' starting letter as bookmarks of level 1, and subsequent country names as bookmarks of level 2.
Custom Visualizations
![]()
![]()
![]()
![]()
Repository URI :/samples/reports/cvc/Figures
Repository URI :/samples/reports/cvc/LeafletMarkers
Repository URI :/samples/reports/cvc/RadialProgress
Repository URI :/samples/reports/cvc/Sparkline
The Custom Visualization Components are an extension point that the JasperReports Library exposes to allow you to embed third-party Javascript-based visualizations into the reports.
The following reports show a few basic examples of custom-made visualizations that leverage D3,
Leaflet and other Javascript libraries to render interactive and animated graphics.
| Figures | Try it: VIEW PDF XLSX |
|
| Leaflef Markers | Try it: VIEW PDF XLSX |
|
| Radial Progress | Try it: VIEW PDF XLSX |
|
| Sparkline | Try it: VIEW PDF XLSX |
Other Reports
| Repo URI | Excel | |
|---|---|---|
| /samples/reports/fonts/FontsReport | XLSX | |
| /samples/reports/NoPagesReport | XLSX | |
| /samples/reports/SlowReport | XLSX | |
| /samples/reports/GroovyReport | XLSX |
License
End User License Agreement
For complete license and notices, see the TIBCO JasperReports IO License and Notices.








































