Jump to content

empty / blank pdf (searched / posted wrong forum)


hd_loki

Recommended Posts

Hi,

 

I inadvertantly searched iReports forum for tips on this and posted before going to the JasperReports forum. I am trying suggestions found there, but am not having any luck.

 

I found one suggestion regarding unchecking the 'ignore pagination' option and tried that but it did not work for me.

 

I looked for a possible overflow parameter on the exporter but could not find one.

 

Can anyone who has solved this problem provide some context and a possible solution?

 

Thanks

Post edited by: hd_loki, at: 2008/03/26 16:37

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Here is the code I am using which I found on a post regarding the same topic:

 

ServletOutputStream outstream = response.getOutputStream();

response.setContentType("application/pdf");

response.setContentLength(pdfasbytes.length);

response.setHeader("Content-disposition","attachment; filename="runs.pdf"");

response.setHeader("Expires","0");

response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");

response.setHeader("Pragma","public");

 

//outstream.write(pdfasbytes);

outstream.write(pdfasbytes,0,pdfasbytes.length);

outstream.flush();

outstream.close();

 

But this isn't working either. Please help.

 

Thanks, Heather

Link to comment
Share on other sites

So the issue did have to do with pagination, but in addition, I had to remove the call

 

Code:
response.setContentLength(pdfasbytes.length);  

 

and instead of

 

Code:
[code]outstream.write(pdfasbytes);

 

I changed the outputstream.write method to include the length and offset

 

Code:
[code]outstream.write(pdfasbytes,0,pdfasbytes.length);

 

in addition to unchecking the ignore pagination flag.

 

:S

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