PdfPTable has no connection with Document. How do you it to know the
page size?
The page width is (document.right() - document.left()) but your logic
will only work if using writeSelectedRows(). If you use Document.add()
the split may be done in other ways.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Peter Lavender [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 04, 2004 11:19 AM
> To: Paulo Soares
> Cc: iText
> Subject: Re: [iText-questions] PdfPTable - getTotalHeight() returns 0
> 
> Hi Paulo,
> 
> >You need setTotalWidth()
> >  
> >
> 
> I must be a bit thick, but I don't get how that is needed 
> when I want to 
> know if the current table's size exceeds the page size.
> 
> I have worked around this by opening a temp document and with the 
> PdfWriter:
> 
> while( writer.fitsPage(tbl) )
> 
> and then delete the temp file..
> 
> But, if there's a way to do it with out creating the temp 
> file and then 
> deleting, then I'd be all for it.
> 
> Thanks.
> 
> >  
> >
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED] 
> >>[mailto:[EMAIL PROTECTED] On 
> >>Behalf Of Peter Lavender
> >>Sent: Monday, October 04, 2004 7:39 AM
> >>To: iText
> >>Subject: [iText-questions] PdfPTable - getTotalHeight() returns 0
> >>
> >>Hi everyone,
> >>
> >>I'm writing a method that calculates the max number of cells 
> >>that will 
> >>fit in a page.
> >>
> >>The crux of it works in the following code:
> >>
> >>            while( tbl.getTotalHeight() < pageSize && cnt < 20 ){
> >>                System.out.println("Table height: " + 
> >>tbl.getTotalHeight() );
> >>                for( int j = 0; j < numColumns; ++j){
> >>                    tbl.addCell(cell);
> >>                }
> >>                cnt++;
> >>                maxCells += numColumns;
> >>            }
> >>
> >>
> >>The output is:
> >>
> >>Page Size: 842.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>Table height: 0.0
> >>
> >>I had to put cnt in there to stop it running, otherwise I get 
> >>an out of 
> >>memory error..
> >>
> >>My question is, why does the getTotalHeight() method always 
> >>return 0.0?
> >>
> >>Thanks.
> >>
> >>
> >>-- 
> >>
> >>Pete
> >>:wq
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>This SF.net email is sponsored by: IT Product Guide on 
> >>ITManagersJournal
> >>Use IT products in your business? Tell us what you think of 
> >>them. Give us
> >>Your Opinions, Get Free ThinkGeek Gift Certificates! Click to 
> >>find out more
> >>http://productguide.itmanagersjournal.com/guidepromo.tmpl
> >>_______________________________________________
> >>iText-questions mailing list
> >>[EMAIL PROTECTED]
> >>https://lists.sourceforge.net/lists/listinfo/itext-questions
> >>
> >>    
> >>
> 
> -- 
> 
> Pete
> :wq
> 
> 


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to