Servoy 6 warning passing image function to jasperreport

Hi,

I get the warning

“The function read(java.net.URL) is not applicable for the arguments (java.io.ByteArrayInputStream)”

about this function:

var image = new Packages.java.io.ByteArrayInputStream(pathToTheImage);
var image_awt = Packages.javax.imageio.ImageIO.read(image);

How can I fix that?

Without looking at this: why not use the images plugin?

Hi Patrick,

because I get an ERROR-exception from plugin:
< java.lang.Exception: Error evaluating expression : Source text : $P{logo_fa} >

I have replaced the Packages-function by

var img = plugins.images.getImage(pathToImage)

but perhaps I need something else to put the image by parameter on a jasperreport?

Ah. I oversaw Jasper.

Just add a type:

/** @type {java.io.InputStream} */
var image = new Packages.java.io.ByteArrayInputStream(pathToTheImage);
var image_awt = Packages.javax.imageio.ImageIO.read(image);

That’s it! Thank you.