See http://itextdocs.lowagie.com/tutorial/objects/tables/pdfptable/index.php 
and chapter 6.1.5 of the book "iText in Action".

Paulo

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Biswa
> Sent: Thursday, July 24, 2008 11:47 AM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Nested PdfPTable table memory leak
>
> Hi Paulo,
> Thanks for your reply. I am going through the tutorials, the
> one thing I notice is to increase the heap size,  in order to
> address the problem. But how can I reduce the memory need for
> such large table or could you point me to some logic
> mentioned in the tutorial that I am missing out.
> Thanks in advance,
> Prakash
>
>
> On Wed, Jul 23, 2008 at 6:05 PM, Paulo Soares
> <[EMAIL PROTECTED]> wrote:
>
>
>       There's no leak there, just a lot of memory needed to
> hold 165000 cells.
>       There are ways to reduce the memory needed, see the
> book or the tutorial.
>
>       Paulo
>
>
>       ----- Original Message -----
>       From: "Biswa" <[EMAIL PROTECTED]>
>       To: <itext-questions@lists.sourceforge.net>
>       Cc: <[EMAIL PROTECTED]>
>       Sent: Wednesday, July 23, 2008 10:39 PM
>       Subject: [iText-questions] Nested PdfPTable table memory leak
>
>
>       Nested PdfPTable table memory leak.
>       Memory leak while creating a large table with more than
> 5000 rows and and 3
>       columns. Each cell of the table will
>       have a nested table of 2 rows and 5 columns each. Could
> anyone help me with
>       this. This is the piece of code that
>       does the creation of table:
>
>       import java.io.FileNotFoundException;
>       import java.io.FileOutputStream;
>
>       import com.lowagie.text.Document;
>       import com.lowagie.text.DocumentException;
>       import com.lowagie.text.PageSize;
>       import com.lowagie.text.Phrase;
>       import com.lowagie.text.pdf.PdfPTable;
>       import com.lowagie.text.pdf.PdfWriter;
>
>       public class PdfHeapTest {
>
>       public static void main(String[] args) {
>
>                      try {
>                              Document document = new Document();
>                              document.setPageSize(PageSize.A4);
>                              PdfWriter writer =
> PdfWriter.getInstance(document,
>       new FileOutputStream("c:\\h1.pdf"));
>                              document.open();
>                              int rows = 5701/1;
>                              int columns = 3;
>                              int innerTableRows = 2;
>                              int innerTableColumns = 5;
>                              PdfPTable table = new
> PdfPTable(columns+1);
>                              for(int j=0;j<rows;j++){
>                                      table.addCell(new
> Phrase("Row"+j));
>                                      for(int i=0;i<columns;i++){
>
> PdfPTable inner = new
>       PdfPTable(innerTableColumns);
>                                                      for(int
>       k=0;k<innerTableRows;k++){
>
> inner.addCell(new
>       Phrase("A"+j));
>
> inner.addCell(new
>       Phrase("B"+j));
>
> inner.addCell(new
>       Phrase("C"+j));
>
> inner.addCell(new
>       Phrase("D"+j));
>
> inner.addCell(new
>       Phrase("E"+j));
>                                                      }
>
> table.addCell(inner);
>
> System.out.println("Row "+ j
>       +" Successfully added");
>                                      }
>                              }
>                              document.add(table);
>                              document.close();
>                      } catch (FileNotFoundException e) {
>                              e.printStackTrace();
>                      } catch (DocumentException e) {
>                              e.printStackTrace();
>                      }
>              }
>
>       }
>
>       Thanks in advance,
>       Regards,
>       Prakash


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to