Hi Paulo,

> You can know the size the table will have by setting the setTotalWidth()
> but you'll have to calculate the effective space by subtracting the
> margins from the page size. 
I'm not interested in the WIDTH but in the LENGTH a table will have,
the number of pages it will occupy. (one or more)
And table.getTotalHeight() only seems to return something meaningful
AFTER
the Document.add() call. I want to know it before adding it to the
document.

> Generally, in this cases, it's easier to do your own layout 
> than trying to get around the limitation of Document.add().
Well, I don't ask for any exotic layout.
I'm trying to avoid that iText takes a new page in trying to keep
together a table
that can impossibly fit on one page (and so will however be split
further on)
I just want to avoid waste of paper (by user request)

  ________________________________
> 
> From: [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
> Sent: Fri 01-Sep-06 16:30
> To: [email protected]
> Subject: [iText-questions] PdfPTable.setKeepTogether(true)
> 
> 
> 
> Hi,
> 
> I wrote a small app to check the behaviour of iText when you add a
> PdfPTable
> to a document via document.add() on which setKeepTogether(true); is set.
> 
> These are my experiences:
> 
> I add a first table of 60 rows. (So the last row is in the upper half of
> the 2nd page)
> Then
> - when I add a 2nd table containing 15 rows, it fits on the rest of the
> 2nd page, so it
>   is placed there. In fact a 2nd table of 33 rows still fits on the 2nd
>   page. So
> - when I add a 2nd table containing 34 rows, it starts on the 3rd page.
>   Which is due to the setKeepTogether(true)
> 
> Now here's the point I have my doubts about:
> - When I add a 2nd table containing 60 rows, it also starts on the 3rd
> page.
>   I wonder why a new page is taken
>      - if the table does not fit on one page
>      - and so will be split further on?
> 
>   The result is:
>   page 1: completely filled (1st table)
>   page 2: less than half filled (last part of 1st table)
>   page 3: completely filled (2nd table)
>   page 4: less than half filled (last part of 2nd table)
> 
>   Since I didn't program any document.newPage() I would have expected
>   the less paper consuming:
>   page 1: completely filled (1st table)
>   page 2: completely filled (last part of 1st table + first part of 2nd
>   table)
>   page 3: (almost) completely filled (last part of 2nd table)
> 
> I know that I can get this result by not applying setKeepTogether(true)
> on the 2nd table,
> but how can I know that I shouldn't? How can I know that the 2nd table
> doesn't fit on one page?
> (according to the methods used by document.add(table))
> 
> Kind regards,
> Geert

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to