Images can't be located with Jasper Reports as attachments

Description

If images are used in Jasper Reports and they are attached there's currently no way of referencing them from the report.

Attachments are stored in a temp-directory and then referenced from the report starter.

Since the temp-directory is not known at design time of the report it isn't possible to reference the image which is located in the temp-directory.
One solution is to have the image accessible at for instance a http-location, but that's not a good long term solution since it's easier to have everything at the same place.

What I did was to set the report's SUBREPORT_DIR to the temp-directory at run time.

This means that subreports as well as images and other resources can be referenced by using the $P{SUBREPORT_DIR} parameter at design time.

Patch attached. NOTE, patch should be applied after patch IDEMPIERE-1215.

Environment

None

Attachments

1

Activity

Show:

Carlos Ruiz April 17, 2015 at 10:59 PM

valid workaround available

Daniel Tamm July 29, 2013 at 5:34 PM

Aha, so RESOURCE_DIR is the way to go

Since it's subreports being dealt with in the code, I don't think it would hurt to add the patch (more flexibility), but I guess the issue it not so important to solve since a work around is available.

I leave the decision to the maintainers of the code

Carlos Ruiz July 29, 2013 at 5:29 PM

Daniel, I can reference attached images on my reports using for example:
$P{RESOURCE_DIR} + "coffee_stain.png"

Won't Fix

Details

Assignee

Reporter

Original estimate

Time tracking

No time logged30m remaining

Components

Priority

Created July 29, 2013 at 4:45 PM
Updated June 1, 2015 at 3:50 PM
Resolved April 17, 2015 at 10:59 PM