These are some very complete answers. I'll add them to the FAQ soon.
Rich Freedman wrote:
I just completed an application that mixes PDF forms with JSPs.
iText was wonderful, but I must say that dealing with the interactions between various versions of various web browsers and versions of Acrobat Reader was quite a challenge.
I did finally get things to work consistently, and here are some of the lessons that I learned:
1. MSIE generally ignores the content-type header. It is a good idea to set it for those browsers that are actually standards-compliant, but MSIE is not. The only way to make sure that MSIE will open a PDF correctly is to ensure that MSIE requests a file with the ".pdf" extension.
While the following solution may be overkill, it works consistently:
Instead of having the browser request a servlet or a JSP, and having that servlet or JSP directly write the PDF to the browser, I have the servlet or JSP produce HTML with an <embed> tag that references a .pdf file. In the web server / servlet container config (I'm using Tomcat), I configure a servlet mapping for "*.pdf" to be sent to my PDF-producing servlet. The reference in the <embed> tag has parameters telling the servlet how to get the data for the PDF. The <embed> tag causes the browser to request a PDF. The servlet returns a PDF, and MSIE happily loads the Acrobat Reader plug-in and displays the PDF.
Besides resolving the MIME-type issue, this also gets around nasty problems like the PDF being handled by the full version of Acrobat (not the reader), if it is installed, and issues about opening Reader in the proper window, etc.
2. It is virtually impossible to completely turn off caching in Acrobat Reader. To deal with this, I make sure that PDF reference in the <embed> tag has a unique name.
I append the current timestamp, to the millisecond, to the root pdf file name. Reader sees this as a "new" document, and doesn't show cached data in the form fields.
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
