Hello,
When I try to create and download a file on the fly on my local development environment, total time elapsed when I start operation takes too long. I hade the sample lines in my code, and It creates about a 1K document but it takes me 56 sec to download/create. Can you help me that what am I doing wrong? Thanks....


response.setContentType( "application/pdf" );
response.addHeader("Content-Disposition", "attachment; filename="XXXXReport.pdf");
Document document = new Document(PageSize.A4.rotate(), 50, 50, 50, 50);
ByteArrayOutputStream buffer=new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, buffer);
try{
document.open();
/* a small table is added to page
}
catch(Exception e) {
e.printStackTrace();
}


   // we close the document
   document.close();

      int size = buffer.size();
      response.setContentLength(size + 2);

      ServletOutputStream outs = response.getOutputStream();
      buffer.writeTo(outs);
      outs.flush();
      outs.close();

      if (size > 0)
         return;

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to