This works for me:
response.setContentType("application/pdf");
response.setContentLength(baos.size());
response.setHeader("Content-disposition", " inline;
filename=report.pdf");
ServletOutputStream sos = response.getOutputStream();
baos.writeTo(sos);
sos.flush();
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of George Maggessy
> Sent: Wednesday, May 11, 2005 5:41 PM
> To: [email protected]
> Subject: [iText-questions] Problems generating PDF file from a Servlet
>
> Hi Gurus,
>
> I have a Servlet that opens a pdf file generate directly
> from iText, I mean, I do not generate a pdf file before. I
> can open this pdf in MSIE or Mozilla when I run it on a web
> server on my machine (Windows 2000), but it doesn't work
> when I deploy this application on an unix environment and
> try to run this servlet on MSIE. In this case, the browser
> asks me to open or save the pdf file. I fails even if I try
> to save or open this file.
>
> Here goes a piece of code:
>
> OutputStream os = (ByteArrayOutputStream) mgr.getPDF(lst);
>
> response.setHeader("Expires", "0");
> response.setHeader("Cache-Control",
> "must-revalidate, post-check=0,
> pre-check=0");
> response.setHeader("Pragma", "public");
> response.setContentType("application/pdf");
> response.setContentLength(os.size());
>
> out = response.getOutputStream();
> os.writeTo(out);
>
> out.flush();
>
>
> Best regards,
> George
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - Find what you need with new enhanced search.
> http://info.mail.yahoo.com/mail_250
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_ids93&alloc_id281&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions