Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gbfragoso/jasperviewerfx
The JasperViewerFX is a free JavaFX library which aims to avoid use of JasperReport's swing viewer
https://github.com/gbfragoso/jasperviewerfx
jasperreports javafx javafx-8 javafx-library pdf-generation pdf-viewer
Last synced: 4 months ago
JSON representation
The JasperViewerFX is a free JavaFX library which aims to avoid use of JasperReport's swing viewer
- Host: GitHub
- URL: https://github.com/gbfragoso/jasperviewerfx
- Owner: gbfragoso
- Created: 2016-10-20T13:54:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-23T13:12:49.000Z (over 4 years ago)
- Last Synced: 2024-10-12T18:41:06.663Z (4 months ago)
- Topics: jasperreports, javafx, javafx-8, javafx-library, pdf-generation, pdf-viewer
- Language: Java
- Homepage:
- Size: 14.9 MB
- Stars: 33
- Watchers: 1
- Forks: 22
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JasperViewerFX
The JasperViewerFX aims to avoid usage of default Swing JasperReport's viewer. This viewer use SwingFXUtils to render only one page at time and append the output image to an ImageView.
![Viewer image](view.jpeg)
# Limitations
JasperReports draw engine relies on awt graphics, drawing each element on a Graphics2D canvas. The JavaFX's GraphicsContext is incompatible with Graphics2D so, even translating the drawing methods, we have memory leaks in some situations. The ImageView method has better overall performance and doesn't cause memory problems, but prevent user to click links and the zoom quality decrease when scaling images.
# Features
- Exporting for PDF, HTML, XML (Without images), XLS, XLSX;
- Zoom in / Zoom Out;
- Interface completely written in JavaFX;
- Current page property.# Dependencies
```
net.sf.jasperreports
jasperreports
6.13.0
```
## Minimal Setup
- Tested with: jasperreports-6.0.0.jar (or above) and Java 8
# Older versions
In older versions of this project the JasperPrint's generation method has been abstracted. We decided to focus on just viewing the report and let the user decide how to generate it.
# How to use
## Example with JDBC connection
```java
try {
Connection con = new ConnectionManager().getConnection();
JasperReport jreport = (JasperReport) JRLoader.loadObject(getClass().getResource("your_resource_path"));
JasperPrint jprint = JasperFillManager.fillReport(jreport, null, con);
new JasperViewerFX(primaryStage).viewReport("Simple report", jprint);
con.close();
} catch (JRException | SQLException e) {
e.printStackTrace();
}
```## Example with JRBeanCollectionDataSource
```java
try {
JRBeanCollectionDataSource source = new JRBeanCollectionDataSource(collection);
JasperReport jreport = (JasperReport) JRLoader.loadObject(getClass().getResource("your_resource_path"));
JasperPrint jprint = JasperFillManager.fillReport(jreport, null, source);
new JasperViewerFX().viewReport("JRBeanCollectionDataSource example", jprint);
} catch (JRException e) {
e.printStackTrace();
}
```