Jump to content
Changes to the Jaspersoft community edition download ×

PDF report and images.


Recommended Posts

By: Alejandro Alliana - aalliana

PDF report and images.

2003-04-14 17:22

I'm trying to modify the webapp sample report this way.

 

I have already made an HTML report to the way I wan't it to. But I have a multiple page report so I have to modify it to work as an PDF report. The webapp example has a PDF example to , so I modified my code to something like:

 

 

File reportFile = new File(application.getRealPath("/reports/ConsolidadoTotal.jasper"));

 

JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());

 

Map parameters = new HashMap();

parameters.put("ReportTitle", "Registro Anecdó´©£o");

parameters.put("BaseDir", reportFile.getParentFile());

 

byte[] bytes =

JasperRunManager.runReportToPdf(

reportFile.getPath(),

parameters,

new ConsolidadoTotal()

);

 

response.setContentType("application/pdf");

response.setContentLength(bytes.length);

ServletOutputStream ouputStream = response.getOutputStream();

ouputStream.write(bytes, 0, bytes.length);

ouputStream.flush();

ouputStream.close();

 

but then I get the following error:

 

java.io.IOException: java.awt.Image fetch aborted or errored

at com.lowagie.text.Image.getInstance(Unknown Source)

at com.lowagie.text.Image.getInstance(Unknown Source)

 

I saved the logo images in the same directory as the html report does, ie: ../images

 

I run linux (rh 80) jdk 1.4.1_02, tomcat, any ideas?

 

aa

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...