Skip to content

Commit

Permalink
added demo example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nabbl committed Jan 26, 2018
1 parent 68552af commit 381e43d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
47 changes: 36 additions & 11 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,70 @@ image:https://travis-ci.org/nabbl/jasper-reporting-service.svg?branch=master["Bu
You'll build a service that will accept HTTP GET requests at:

----
http://localhost:8080/reports/rpt_example/?format=pdf&personid=1
http://localhost:8080/reports/PieChartReport/?format=pdf&MaxOrderID=10800
----

and respond with a link:Jasper Report Document in the format you specified
and respond with a link:Jasper Report Document in the format you specified (`pdf / html / csv / xls / xlsx`)


You can customize the request with optional `parameters` in the query string:

----
http://localhost:8080/reports/rpt_example/?format=pdf&personid=1&param1=test&param2=tester
http://localhost:8080/reports/PieChartReport/?format=pdf&MaxOrderID=10800&ReportTitle=test&param2=test&param3=test
----

It is important that these parameters are supported in the SQL query string in the underlying `.jrxml` Jasper template

== What you'll need

- java_version: 1.8
- maven: >3:

== How to run it
- maven: >3: (for building the project if you wish to)

== How to build it

use the following command in the cloned directory:

----
mvn package
----

It's generating a JAR-file (e.g. jasper-reporting-service-0.1.0.jar) in the target directory
== How to run the DEMO package

Download the latest release from here: https://github.com/nabbl/jasper-reporting-service/releases[Releases]

Download the "config" and "demo" directories from https://github.com/nabbl/jasper-reporting-service/[github]

run with
Folder structure should look like this:

----
java -jar target/jasper-reporting-service-0.1.0.jar:
- config
--application.properties
- demo
--data
--fonts
--images
--reports
- jasper-reporting-service.jar
----

test with
Install the FONTS on your system from `demo/fonts`

Run SQL from `data/h2_data.sql` against your Demo-Database (in-memory H2 database is pre-configured!)

If you wish to use the pre-configured H2 database activate the "h2 console" in `config/application.properties` and run the SQL script in the GUI: `localhost:8080/h2`

Run with command:

----
http://localhost:8080/reports/rpt_example/?format=pdf&id=1
java -jar jasper-reporting-service.jar:
----

test with:

----
http://localhost:8080/reports/PieChartReport/?format=pdf&MaxOrderID=10800
----

You should get a nice looking PDF-Report looking like this:

image::/demo/images/example_pdf_report.png[]
10 changes: 10 additions & 0 deletions config/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# H2
spring.h2.console.enabled=false
spring.h2.console.path=/h2
# Datasource
spring.datasource.url=jdbc:h2:file:~/test
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
# Custom Parameters
reports.directory=/demo/reports/
Binary file added demo/images/example_pdf_report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 381e43d

Please sign in to comment.