You can use direct content and high level objects. In this case you just 
need to break the table in several smaller tables.

Paulo

----- Original Message ----- 
From: "Sam Green" <[EMAIL PROTECTED]>
To: "Post all your questions about iText here" 
<itext-questions@lists.sourceforge.net>
Sent: Monday, December 11, 2006 1:43 PM
Subject: Re: [iText-questions] Memory usage


> Thank Paulo,
>
> It seems strange to me that the massive leap in memory usage occurs when
> the PdfPTable is added to the document, rather than when the large
> complex PdfPTable is created.   But I guess it's feasible that writing
> to the PDF document requires an extra proportional amount of memory
> resources to the size of the object being written.   Would that be 
> correct?
>
> Looks as though I'm going to have to start delving into the direct
> content more and more! *gulp*
>
> Thanks again,
> Sam.
>
>
>
> Paulo Soares wrote:
>> See
>> http://itextdocs.lowagie.com/tutorial/objects/tables/pdfptable/index.html#memory
>>
>> Paulo
>> ----- Original Message ----- 
>> From: "Sam Green" <[EMAIL PROTECTED]>
>> To: "iText Mailing List" <itext-questions@lists.sourceforge.net>
>> Sent: Monday, December 11, 2006 1:05 PM
>> Subject: [iText-questions] Memory usage
>>
>>
>>
>>> Hi there,
>>>
>>> I'm having some issues with the amount of memory PDF generation is
>>> using, and I'd just like to run it past you to see if you have any ideas
>>> as to the best way to tackle it!
>>>
>>> I'm running this as part of a tomcat application.
>>>
>>> I'm using the following code to open up the file and write the data:
>>>
>>> Document document = new Document();
>>> PdfWriter writer = PdfWriter.getInstance( document, new
>>> FileOutputStream( temporaryFileName ));
>>> document.open();
>>> // Add a title page first.
>>> ..
>>> // Add main pages.
>>> PdfPTable table = getPDFRendering();
>>> document.add( table );
>>> document.close();
>>>
>>>
>>> getPDFRendering()  is generating a few nested PdfPTables with the
>>> occassionally text Chunk,   with a large PdfPTable at its core.
>>> This data table contains 500-1000 rows of ~30 columns (each cell
>>> containing, typically, an integer).  I am also using an extra empty cell
>>> between each cell for spacing (I am reusing my 'blank cell' object for
>>> each of these empty cells).
>>>
>>> while watching 'top' when the 'document.add' line gets executed, the
>>> memory usage of tomcat increases by ~500mb.
>>>
>>> There are a few points I thought of:
>>> - That's alot of data.  However, I'd like to find ways of being able to
>>> generate the PDF while trying to control the memory usage.
>>> - Extra empty cell for spacing might be a bit retarded,  is there some
>>> 'cell padding'  i can add to the PdfPTable?
>>> - Is there something odd adding to the overhead? E.g. having a large
>>> table inside a bunch of nested tables?
>>> - Would it be better on memory to, instead of creating the table and
>>> then adding it to the document, pass the document into the method that
>>> generates the main table and do the following:
>>>
>>> document.add( table );
>>> ...
>>> for( int i=0; i<rows; i++ ) {
>>>    for( int j=0; j<cells_in_row; j++ ) {
>>>        table.addCell( blah );
>>>    }
>>> }
>>> ...
>>>
>>> Would any of these ideas help substantially?  Is there anything else I
>>> can try?
>>>
>>>
>>> Thanks for your help,
>>> Sam.
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>>> your
>>> opinions on IT & business topics through brief surveys - and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>> _______________________________________________
>>> iText-questions mailing list
>>> iText-questions@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>>>
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share 
>> your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>>
>
> -- 
>
> Sam Green
> Flextrade UK
> (44) 0207 796 3001
> 8 Fredericks Place
> London EC2R 8AB
>
> This communication is for informational purposes only. The contents of 
> this
> transmission are confidential and intended solely for the use of the
> individual or entity to whom they are addressed.If you have received this
> email in error please notify the sender by return email  and  delete this
> message from your system.
>
> Flextrade Systems Inc., its subsidiaries and affiliates do not guarantee 
> the
> completeness and accuracy of this transmission's contents. Moreover,
> Flextrade Systems Inc., its subsidiaries and affiliates do not guarantee
> this communication to be free of viruses and accept no liability for any
> damage caused thereof.
>
>
>
>


--------------------------------------------------------------------------------


> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share 
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


--------------------------------------------------------------------------------


> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
> 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to