Jump to content
JasperReports Library 7.0 is now available ×

PDF files won't display in browser


Recommended Posts

By: Lou Fox - foulox

PDF files won't display in browser

2002-09-13 12:56

Whenever I try to view a pdf through IE6.0 that has been compiled by JasperReports, it asks to save the practiceReport.jsp as a pdf file instead of displaying it. However, if I try to open practiceReport.pdf IE6.0 opens it without a problem. Mozilla, opens it the same file without a problem, either way.

 

I'm using Tomcat 4.04 on win2k.

 

Here's my jsp code:

byte[] bytes =

JasperRunManager.runReportToPdf(

reportFile.getPath(),

parameters,

getConnection()

);

ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);

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

 

response.setContentType("application/pdf");

response.setContentLength(baos.size());

ServletOutputStream outputStream = response.getOutputStream();

baos.writeTo(outputStream);

outputStream.flush();

outputStream.close();

baos.flush();

baos.close();

 

Any thoughts?

 

 

By: Teodor Danciu - teodord

RE: PDF files won't display in browser

2002-09-16 01:06

 

Hi,

 

You can find more about this on the following thread:

 

https://sourceforge.net/forum/forum.php?thread_id=710975&forum_id=113529

 

I hope this helps.

Teodor

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