Jump to content
Changes to the Jaspersoft community edition download ×

PDF generation problem

Recommended Posts

By: Stephen Ho - sfgear

PDF generation problem

2003-06-06 05:24



I had encountered PDF generation problem using servlet/datasource approach.

The servlet code is an extact copy of the sample code from the webapp Demo

(Jasper Report) and was integrated into a Struts action servlet.


I got these errors in the popup windows in IE 6:


1. "File Download" window with warning "This type of file could harm your

computer if it contains malicious code" and ask to Open, Save or Cancel,...

2. IE error window "Internet Explorer cannot download jasperReportPDFTest

from localhost, Internet Explorer was not able to open this Internet site.

The request site ie either unavailable or cannot be found. Please try again



It works on HTML generation.

- Does anyone has any idea why this is happening?

- Is it something to do with "setContentType("application/pdf")"?


Thanks for the advise






By: Stephen Ho - sfgear

RE: PDF generation problem

2003-06-07 04:53

I had resolved this problem and hope this will help if you had encountered this situation too.


// Modified






// Modified

response.setHeader( "content-disposition","inline; filename=testPDF.pdf" );


ServletOutputStream ouputStream = response.getOutputStream();

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




When replacing the content-disposition's "inline" action to "attachment", the client will have the option to either Open or Save the PDF file.



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