Hi All,

I have written a servelt to generate PDF. When I access the servlet from IE 
5.5, the pdf document is not visible. If I click refresh once then it opens. 
What could be the problem. Here is the code.

public void service(HttpServletRequest req, HttpServletResponse res)
throws javax.servlet.ServletException, IOException
{
                res.setContentType("application/pdf");
                OutputStream out = res.getOutputStream();
                Document document = new Document();
                try
                {
                        PdfWriter writer = PdfWriter.getInstance(document, out);
                        document.open();
                        PdfPTable table = new PdfPTable(1);
                        
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
                        table.setWidthPercentage(100);
                        PdfPCell cell = new PdfPCell(new Phrase("Hello World!!"));
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setPaddingTop(5);
                        cell.setPaddingBottom(5);
                        table.addCell(cell);
                        document.add(table);
                }
                catch (Exception e)
                {
                        e.printStackTrace();
                }
                out.flush();
                document.close();
                out.close();
}

reply to: [EMAIL PROTECTED]

Thanks

Aspert

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to