the header
Cach-Control: No-cache
Causes Internet Explorer to dispose of the pdf file just prior to launching the Acrobat Reader plugin causing the blank page.
According the the microsoft kbase article 293792 http://support.microsoft.com/default.aspx?scid=kb;en-us;293792
The problem was the Cache-Control: No-cache header. This header was added automatically by the Borland Enterprise application server. It wasn't added by my test environment which is apache/tomcat.
So, to cure the problem I added the line
response.setHeader("Cache-Control", "max-age=30");
This overrides the app server's desire to add a Cache-Control header, and allows IE to cache the document for 30 seconds (sufficient time to allow AcrobatReader to open the file).
-jason
On Nov 6, 2003, at 12:56 PM, Jason Essington wrote:
O.K. this has been hashed over thousands of times, but I am sure that this used to work, but now it's not. I am trying to view dynamically created pdfs with IE (in my case ie 6.0 and acrobat reader 6.0)
my code requires that a servlet be called as a POST and supply some parameters for generating the pdf file. the code that actually returns the pdf from the servlet looks like:
[code]
byte[] pdf; try { pdf = runReports (lots, of, parameters, go, here); } catch (DocumentException de) { throw new ServletException(de.getMessage()); } response.setContentType("application/pdf"); response.setContentLength(pdf.length); ServletOutputStream out = response.getOutputStream(); out.write(pdf); out.close();
[/code]
and the response from the server looks like:
[code]
HTTP/1.1 200 OK
Date: Thu, 06 Nov 2003 18:36:14 GMT
Server: (IIOP/1.1 Connector)
Set-Cookie: CP_GUTC=10.19.235.134.1068143774786220; path=/; expires=Mon, 30-Oct-28 18:36:14 GMT; domain=domain.removed.to.protect.the.guilty
content-type: application/pdf
content-length: 2072
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: No-cache
Cache-Control: no-cache
Connection: close
%PDF-1.4
-- pdf content clipped --
%%EOF
[/code]
Everything looks fine, but IE will not show the pdf in the browser. If AcrobatReader is configured to not show PDFs in the browser, all is well.
I've read the FAQ and this looks to conform to those suggestions.
The interesting thing is that the exact same code running on my local server works with no problems (different dataset, so the content is a different size).
It's response looks like:
[code]
HTTP/1.1 200 OK
Date: Thu, 06 Nov 2003 18:52:04 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.1.2 mod_perl/1.26 mod_jk/1.1.0
Content-Length: 2097
Connection: close
Content-Type: application/pdf
%PDF-1.4
-- pdf content clipped --
%%EOF
[/code]
So, maybe it's one of the additional headers added by the borland app server that's causing IE the problems?
Set-Cookie: Expires: Thu, 01 Jan 1970 00:00:00 GMT Pragma: No-cache Cache-Control: no-cache
any IE gurus out there have any idea if one of these headers is confusing IE?
-jason
------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
