Sample project using JasperReports to generate pdf documents

Hi, this is the initial post of a series where i’ll be publishing some samples showing how to generate pdf documents with the popular library JasperReports using the Java API.

You can read more about JasperReports in here.
Pdf document templates were designed with iReport Designer

Sample code to generate blank pdf document.

Project samples:

*All running tests create a pdf document in the hard-coded path set and hang the current java process.While the process is running you can preview the pdf with your favourite tool.
When you stop this process, the document is deleted. This is the behaviour.

jasperreports-hello-world-pdf‘ – is the simplest sample where a blank pdf is generated. Run the main class ‘JasperReportsApplication’ and adjust the directory where the pdf file is created to fit your environment.

jasperreports-pdf-image‘ – this sample shows how to insert an images in several ways inside a pdf.
Run the tests declared in ‘ImageIT’ and adjust the directory where the pdf file is created to fit your environment.

jasperreports-pdf-table‘ – this sample shows how to fill a table with data inside a pdf using a ‘JRBeanCollectionDataSource’.
Run the test in ‘TableIT’ and adjust the directory where the pdf file is created to fit your environment.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s