Page 1 of 1

Images via variables

Posted: Wed Feb 13, 2013 12:50 am
by Chipo
Hi,

can I populate image on report via report variables?

Idea is to define var on the report and before rendering set values for those variables, so report to display them.
Is it possible ?
What type of variables should be (String, Image, ...) ?
How to set source for image field on the report ?

Thank you for great job, reports are awesome.

Re: Images via variables

Posted: Wed Feb 13, 2013 1:04 pm
by HighAley
Hello.

Yes, it;s possible.
You could use Image Data property.
Do you have any difficulties with it?

Thank you.

Re: Images via variables

Posted: Tue Apr 30, 2013 12:46 am
by Chipo
Hi,
this question pop up again.

I need to use images on the report. I can not use url to image resource, because it called for every report page (no caching).
The only option I have is to create report variable and populate it before the actual report rendering.

My questions:
1. What type of variable on the report it should be? (String or Image) I am going to use this variable as a value for the "Image Data" of Image component.

2. How I can populate its content?
Currently I do the following (this is not exact code but idea of what I do):

Code: Select all

var content:String = StiTypeConverter.byteArrayToBase64(byteArrayContent);
....
stiReport.dictionary.variables[...].valueObject = content;
Please advise what I do wrong. All described above does not work. Image is blank.

Best regards. Summer is coming :) (not for me :( wrong semisphere)

Re: Images via variables

Posted: Thu May 02, 2013 7:34 am
by HighAley
Hello.

It's possible to use JPEG or PNG images only.
Here is your code with some corrections:

Code: Select all

var png: PNGEncoder = new PNGEncoder();
var bytes: ByteArray = png.encode(bitmapData);  // byteArrayContent in your case, should be BitmapData

var content:String = StiTypeConverter.byteArrayToBase64(bytes);
....
stiReport.dictionary.variables[...].valueObject = content;
Thank you.