Farjad Babar
Farjad Babar

Reputation: 53

Upgrading JasperReports 1.3.1 to JasperReports 4.6

I am upgrading my JasperReports version as mentioned in the title. I don't know much about the JasperReports version upgrade. Which all things I have to change to make it work. I have latest .jar files of everything. But when I print my .PDF report it gives me this error.

error:could not open file because its damaged or not supported.

In eclipse it shows this exception

java.lang.NoSuchFieldError: PRINTSCALING at 
net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExpor‌​ter.java:532) at 
net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java‌​:396) at 
net.sf.jasperreports.engine.JasperExportManager.exportToPdf(JasperExportManager.‌​java:212) at 
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdf(JasperExportMa‌​nager.java:536) at 
com.sibisoft.northstar.util.JasperReportGenerator.getPdfByteArray(JasperReportGe‌​nerator.java:679)

Please help me.

Upvotes: 3

Views: 6325

Answers (1)

Jacob Schoen
Jacob Schoen

Reputation: 14192

The issue is not with JasperReports but with the version of the iText library you are using. You need to download version 2.1.7 to work with that version of JasperReports. You can get it from here.


I happened to know this one off the top of my head, as I ran into it in the past, but as a helpful note in the future, this is the process I used to figure it out originally.

Since JasperReports is open source, the code can be found online easily. So I google:

site:grepcode.com net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream

To find the code online. (GrepCode basically provides a cool site to look through many open source projects source code.)

At the top of the GrepCode page they have the version of the project, so make sure it is pointing to which ever version you are using.

Then find the method or line number in the error message.

From here it is just like debugging local code. You can see what the offending class is, and what package it belongs to. In this case it points to the itext libray as the culprit.

Hope that helps you out in the future, and happy reporting.

Upvotes: 6

Related Questions