It might help if you wrote your document to the ByteArrayOutputStream before you set the content length and transfer the contents to your ServletOutputStream....
-Matt --- Lord Zefyrus God <[EMAIL PROTECTED]> wrote: > hi > > i know that i'm boring you all, but i puted he > content.lenght at it and > it returs zero. > > here is the code: > > public void doGet (HttpServletRequest request, > HttpServletResponse response) > throws IOException, ServletException { > Document document = new Document(); > try { > // step 2: we set the ContentType and > create an instance of the > corresponding Writer > > response.setContentType("application/pdf"); > ByteArrayOutputStream ba = new > ByteArrayOutputStream(); > > response.setContentLength(ba.size()); > ServletOutputStream out = > response.getOutputStream(); > ba.writeTo(out); > out.flush(); > document.open(); > document.add(new Paragraph(new > Date().toString())); > document.add(new Paragraph(new > Paragraph("" + ba.size()))); > > } > catch(DocumentException de) { > de.printStackTrace(); > System.err.println("document: " + > de.getMessage()); > } > document.close(); > } > > tks > > Zefyrus > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at > http://explorer.msn.com/intl.asp. > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for > download mirrors. We supply > the hardware. You get the recognition. Email Us: > [EMAIL PROTECTED] > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions __________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions