JasperReports – Image Loading Static Vs Dynamic

Problem: How to load images in JasperReports?

This is the best way to refer static images.

<imageExpression class="java.lang.String"><![CDATA["images/image1.jpg"]]>  

Images must be in the class path. We can pass this value through variable too.

This is the best way to load dynamic images.
Which means that we want to manipulate images based on runtime logic.

<imageExpression class="java.awt.Image"><![CDATA[$F{dynamicImageName}]]>

These images can be picked up from class path or manipulated in memory during run time.
Example: Graphs, Pie Charts …etc

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