Thanks for the detailed answer.
Even witht he approach you mentioned I'm not sure how knowing the count
will help. The cells are variable length/height so I really need to know
the position of the summary not the count of cells.
On Sun, Nov 6, 2011 at 9:13 AM, 1T3XT BVBA <[email protected]> wrote:
> On 6/11/2011 14:43, tvfoodmaps wrote:
> > I have a table that spans many pages. The table basically has a
> > repeating structure of:
> >
> > summary row
> > 1-N cells
> > summary row
> > 1-N cells
> > .....
>
> OK.
>
> > What I am trying to do is prevent the last row on a given page from
> > being a summary row.
>
> OK, so the summary row can appear on every place in the table, but it
> may never be the final row on a page.
>
> > I tried to add a generic tag to the summary row
>
> As documented, the onGenericTag() method is called AFTER a Chunk has
> been rendered to the page.
>
> > and use the rectangle to detect the position.
>
> But once you get that rectangle, it's too late to do something about it.
>
> > This allows me to detect when the summary row is the last row, but I
> > can't seem to fix it.
>
> That's normal. See above to understand why.
>
> > I tried to add document.newPage in the onGenericTag but it doesn't work.
>
> The document object is NOT the Document you're working with, but an
> instance of the internal PdfDocument class. As explained in the iText
> documentation, you should use the document object as a READ-ONLY object.
> NEVER USE IT TO CHANGE CONTENT.
>
> I think that you'd benefit from reading chapter 4 of "iText in Action -
> Second Edition". I think you're making the mistake of creating the
> complete table up-front BEFORE adding it to the document. Why don't you
> create several small tables instead? As the tables will be glued
> together, nobody will notice that the large table consists of several
> smaller tables.
>
> Also don't add the table with document.add(), but use a ColumnText
> object. From here on, you have several options. For instance: you could
> add tables that start with a summary row in simulation mode, and use a
> table event to find out how many rows were added.
>
> In iText 5.1.3 (scheduled to be released on November 11), ColumnText
> will also have a method to find out how many rows were added.
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
--
Thanks,
Frank
http://wwww.tvfoodmaps.com
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php