I also use a web framework (though not struts) and I also had a problem trying to send back a PDF through it, it's best to set up a seperate direct servlet for this.
-Bill Ensley Bear Printing > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of George > Maggessy > Sent: Wednesday, May 11, 2005 11:43 AM > To: [EMAIL PROTECTED] > Cc: [email protected] > Subject: RE: [iText-questions] Problems generating PDF file from a > Servlet > > > Hi Paulo, > > It doesn't work either. > > Maybe my problem is in the fact that I do a forward from a > Struts Action (Print.do) to my servlet PrintServlet that in > fact generates the pdf file. When the MSIE opens the > SAVE/OPEN file window it shows the file name as if it were > Print.do?dummy=report.pdf. The dummy parameter that > finishes with .pdf was a suggestion found on internet. > > Best Regards, > George Maggessy > > --- Paulo Soares <[EMAIL PROTECTED]> wrote: > > 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 > > > > > > > > > > > Yahoo! Mail > Stay connected, organized, and protected. Take the tour: > http://tour.mail.yahoo.com/mailtour.html > > > > ------------------------------------------------------- > 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_id=7393&alloc_id=16281&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
