Jump to content

Problem exporting to PDF - blank document


Recommended Posts

By: real_braindance - real_braindance

Problem exporting to PDF - blank document

2006-04-21 05:01

Hi!

 

I have very strange problem with exporting complex enough jasper report to PDF. Exporting to XLS and HTML works fine.

Sometimes (not in every case) depends on how much data or elements placed on jasper report after exporting to PDF I get blank document. But interesting thing that it is big sized blank document (200 Kb) and with scrolling.

Can someone advice something for me to try to do with this?

 

P.S. I tryed lots of thnings, but couldn't find the logic and the reason why this happends. I used itext 1.3.1 and 1.4 and jasperreports 1.2.0 and 1.2.1 but it doesn't help.

 

Thank you in advance

Link to comment
Share on other sites

  • 8 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

I am seeing a similar problem. The PDF export seems to work from my tomcat server on my local machine (windows box) but when I move the code up to a Linux test server the pdf page will display blank. I am using code similar to that of the Webapps sample.

 

Thanks

Link to comment
Share on other sites

I fixed my problem with this code found on another post:

 

byte[] bytes = null;

bytes = report.getReport();

if(bytes != null && bytes.length > 0){

response.setContentType("application/pdf");

response.setContentLength(bytes.length);

ServletOutputStream outputStream = response.getOutputStream();

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

outputStream.flush();

outputStream.close();

Link to comment
Share on other sites

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...