my dog learned polymorphism*
The moose likes Other Open Source Projects and the fly likes PdfPTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "PdfPTable" Watch "PdfPTable" New topic
Author

PdfPTable

Chris Lonie
Greenhorn

Joined: Sep 17, 2002
Posts: 3
Bruno,

We are using iText and very happy with it. The one area that I have not come up with a good answer is for our table of addresses. We are using PdfPTables. The table is 2 columns wide by 3 rows high. Each cell also contains another PdfPTable. This is done so that the top of each pair of inner tables (of each row of the outer table) is at the same height on the page. Our problem is that we have to force a new page before beginning the outer table since we have quite a bit of address data, sometimes leaving alot of white space on the previous page. Is there a better way of doing this instead of the nested tables?

Thanks,
Chris
Bruno Lowagie
author
Ranch Hand

Joined: Oct 23, 2006
Posts: 88
Originally posted by Chris Lonie:
Is there a better way of doing this instead of the nested tables?


You have something like this:

+-------+-------+
| table | table |
+-------+-------+
| table | table |
+-------+-------+
| table | table |
+-------+-------+

Before adding this to the document,
you perform document.newPage().

I assume that you want to split the table.
Question is: (how) do you want to split the table?

Which part of the table do you want on the
current page, and which part should be forwarded.
Do you want to split the table keeping the rows
of the outer table complete (no splitting of the
inner tables), keeping the rows of inner tables
complete (no splitting of inner rows), or can
inner rows be cut in two?

I'll try to provide an example with the different
possibilities soon. There's an example in the book,
but it doesn't involve nested tables.

br,
Bruno
Chris Lonie
Greenhorn

Joined: Sep 17, 2002
Posts: 3
Bruno,

Yes, the table does look the way you drew it and, yes, we do perform a document.newPage().

I would like to keep the rows of the inner table complete. If it is easier to allow the inner rows be cut in two, then that is also very acceptable.

Thanks,
Chris
Bruno Lowagie
author
Ranch Hand

Joined: Oct 23, 2006
Posts: 88
Originally posted by Chris Lonie:
I would like to keep the rows of the inner table complete. If it is easier to allow the inner rows be cut in two, then that is also very acceptable.


OK, I've been very busy today.
I'll try to find some time to write you some sample code tomorrow.
Chris Lonie
Greenhorn

Joined: Sep 17, 2002
Posts: 3
Thank you - it is very much appreciated.
Bruno Lowagie
author
Ranch Hand

Joined: Oct 23, 2006
Posts: 88
This is an example demonstrating how nested tables are split:


[ UD: Broke long line into two, so that the layout doesn't get screwed up. ]
[ November 18, 2006: Message edited by: Ulf Dittmer ]
Bruno Lowagie
author
Ranch Hand

Joined: Oct 23, 2006
Posts: 88

UD: Broke long line into two, so that the layout doesn't get screwed up.


Thanks!
I'll put the next code sample (adding a submit button to an existing form) online somewhere, so that people don't have to copy/paste.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PdfPTable
 
Similar Threads
iText - problem in splitting tables across multiple pages
Create table rows dynamically after reading from pdf template
Data fetch from multiple SQL tables
How to add curve to the pdftable in itext
Download PDF