Jasper AD_Image

166 views
Skip to first unread message

Fabian Aguilar

unread,
Oct 22, 2014, 6:34:08 PM10/22/14
to idem...@googlegroups.com
Hello comunity, I want to know if someone had the experience yo build a report on jasper that
can display the ad_image related to a record of any table?

regards.

Carlos Antonio Ruiz Gomez

unread,
Oct 23, 2014, 10:15:46 AM10/23/14
to idem...@googlegroups.com
Fabian, two possible methods:

Found this from an old IRC chat:

<tbayen> I am mostly using JasperReports.
<tbayen> I have a german wikipage about that at
http://wiki.idempiere.org/de/JasperReports#Images_in_Reporten
<tbayen> But I can explain it here in english. That will be better for you
<tbayen> In the paragraph "Images in Reporten" you see a piece of SQL
code. You have to get the image binary data out of the AD_Image table.
<tbayen> Then you use the other code example: "new
java.io.ByteArrayInputStream((byte[])$F{binarydata})" in your jasper
image object.
<tbayen> With that you create an InputStream out of the SQL query's data.
<tbayen> The image object can use the ByteArrayInputStream to show the
image.
<tbayen> There is a case that is not easy to solve but it is solved by
my own new Jasper Plugin: The image is not cached. If you use the same
image a hundred times in a document with a hundred pages then the pdf is
100*size bigger than without the logo. My
plugin makes that the logo is loaded only once.

<CarlosRuiz> tbayen - sometimes I also use MImage to get the logo if I
have the Logo_ID in the report
<CarlosRuiz> instead of bringing the binary on the select
<CarlosRuiz> in jasper I declare an java.awt.Image object and fill the
variable expression with
<CarlosRuiz>
org.compiere.model.MImage.get(org.compiere.util.Env.getCtx(),
$F{logo_id}.intValue()).getImage()

NOTE: my method used to work on adempiere, haven't checked if it still
works on iDempiere, any feedback appreciated

Regards,

Carlos Ruiz
> --

redhuan d. oon

unread,
Oct 23, 2014, 1:01:03 PM10/23/14
to idem...@googlegroups.com
I wonder if a method i just tried, of reusing a sub report containing the image, again where needed is also good. The jaspers are stored rather than attached in my case.

Turker TUNALI

unread,
Oct 23, 2014, 5:17:08 PM10/23/14
to idem...@googlegroups.com
This video shows how can display Organization's logo in invoice with Jasper Report
http://www.youtube.com/watch?v=qupDLprUoJE

Alejandro Guerra

unread,
Oct 24, 2014, 10:03:14 AM10/24/14
to idem...@googlegroups.com
We can use language groovy ??

Victor Suárez

unread,
Oct 24, 2014, 4:45:17 PM10/24/14
to idem...@googlegroups.com
Alejandro, I think that can't use language Groovy.
Reply all
Reply to author
Forward
0 new messages