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. Generally, in this cases, it's easier to do your own layout than 
trying to get around the limitation of Document.add().
 
Paulo

________________________________

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 - The professional email service


-------------------------------------------------------------------------
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




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.

<<winmail.dat>>

-------------------------------------------------------------------------
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