JasperReport, Image & PDF

I have a problem when generating a report via the Jasper plugin.

I’m using Servoy 4.01 in MacOS X 10.4.11, the latest version of the Jasper plugin, JasperReports 3 and mySQL.

The problem only occurs when I try to generate a report via the Jasper plug-in, to PDF format, AND the report has a fixed jpeg image on the report layout. As soon as I remove the image from the report in iReport and re-compile the report, the report generates fine when triggered from Servoy.

The following code does not work unless the fixed image is removed from the jasper file (note I want the output to be PDF here ):

var filepath = '/test.pdf'
plugins.jasperPluginRMI.jasperReport(currentcontroller.getServerName(),'test.jasper',filepath,'pdf',{people_id: people_id});

When I set the output to ‘view’, the Jasper viewer comes up and displays the report and image properly. This code works just fine ( note I set the output to view ):

plugins.jasperPluginRMI.jasperReport(currentcontroller.getServerName(),'test.jasper',filepath,'view',{people_id: people_id});

Any ideas?
Could I possibly do this another way?

Ken Keen

Hi Keen,

do you get some kind of error?

Harjo,

I don’t see any errors. The console is empty and the server log reports nothing.

Since I posted the original problem, I found that the script code after the plug-in call does not fire. It appears the script is halted at the point of the plug-in call failing. Just to be sure, I verified that the remaining code does execute when I set the output to ‘view’.

Isn’t it a problem that you don’t have write access to ‘/test.pdf’?
Shouldn’t this be a full path?

Hi keen,

Try this

var filepath = plugins.jasperPluginRMI.reportDirectory + ‘/test.pdf’;

plugins.jasperPluginRMI.jasperReport(currentcontroller.getServerName(),‘test.jrxml’,filepath,‘pdf’,{people_id: people_id});

hope this might help…

Thanks
Prem

Isn’t it a problem that you don’t have write access to ‘/test.pdf’?
Shouldn’t this be a full path?

Martin, Prem,

Thanks for the ideas.

I used ‘/test.pdf’ to keep thing simple. The script will generate ‘test.pdf’ at the root of my hard drive if I do not have the graphic image in the Jasper file. The second I add a fixed jpeg image to the jasper file, ‘test.pdf’ will not be generated at this location and the remainder of the script is not executed. I have write access ‘/’ and I tried writing to the report directory as well. This doesn’t seem to be a write access issue. It is entirely dependent on having a linked graphic file in the Jasper file.

Hi keen,

Have you tried JasperReport in servoy smart client.? Is it working.? i have tried but at my end it is not working.

if it is wokring in smart client at your end. Please tell me how can i make it possible at my end.

Thanks
Prem

Have you tried JasperReport in servoy smart client.? Is it working.? i have tried but at my end it is not working.

When I have no image in the Jasper file, it works from both the Smart Client and the Web Client.

if it is wokring in smart client at your end. Please tell me how can i make it possible at my end.

I’m not sure what you mean. I’m testing with a very simple JasperReport file with a single field on it and a linked jpeg file. If you look at my code in the first post, you’ll see I’m passing a primary key value to the report. I’ve broken this problem down to the bare minimum to isolate the problem.

Hi Keen,

I also made a simple JasperReport. I am also displaying images. Report is working fine in Servoy Developer, but when i am checking the same in smart client. JasperReport is not working.

I want to know what should be the cause JasperReport not working in smart client.

Thanks
Prem

Are you able to give more specifics on the errors when using in smart client? Right now what you give in the posting is very general.

Prem, are you using Servoy 4.01 or 3.5? This is only a problem in 4.01. It worked fine in 3.5. Maybe I am misunderstanding what you mean by ‘working fine in Servoy Developer’.

Thomas, I don’t know what further information I can provide. If you read through the entire thread, you’ll see that I don’t get any errors logged anywhere. The report simply doesn’t work when I have an image in the Jasper file. The PDF isn’t generated in the location I specify and the script stops at the point of calling the plugin. If I remove the image from the Jasper file, everything works as expected.

Keen, I am using Servoy 4.0.1. Servoy Developer means, servoy developer’s smart client option. In my case log dosen’t have any error message regarding not working JasperReport in smart client.

Keen i am also using some static image in my report, When i am generating pdf it is containing image.
What i have done.

  1. Whatever the image i am using, placed into report directory report/image.
  2. I have placed image element on iReport provide a path of image.

Thanks
Prem

Prem,

It sounds like you are reproducing my problem on your end. Maybe I’m not crazy after all!

keen,

Problem only with JasperReport at my end. It is not working in Servoy smart client.

Thanks
Prem

Hi,

Requirement is to create the dynamic table by reading the XML tag values in runtime. XML file has the tags which will tell us about the number of rows and columns. Also, there are two tags which will tell us about the specific cell to be highlighted. E.g.;

3
3
2
1

3 by 3 table should get displayed in the output with 2nd row 1st column highlighted.

Hint: can we use a image which will look like 1 by 1 table and repeat it 3 times???

Regards,
Amit

Sounds like this may be an issue to be posted to the plug-in’s Google code site. Anyone at Servoy agree?

I managed to reproduce the error. Indeed, when outputing to pdf it does not work if the report has an image. Don’t know yet what causes this. Please create a case at the google-code site. Thanks.

I managed to reproduce the error. Indeed, when outputing to pdf it does not work if the report has an image. Don’t know yet what causes this. Please create a case at the google-code site. Thanks.

Posted: http://code.google.com/p/servoy-jasperr … etail?id=6

Ken,
FYI: the JasperReports plugin that I upgraded myself appears to handle images ok in 3.5.7. I have not tested in 4.x
Have you got a fix yet?
Tom

Tom,

If I understand this thread correctly, http://forum.servoy.com/viewtopic.php?f=38&t=11407,

Paul is stating this issue is taken care of with the 4.1 b4 update. The updates on the Google code site for the plugin also say the same thing.

I haven’t had time to try it out yet but will do so this week.

Thanks for making me aware of your upgrade!