Thanks for the suggestion, Paulo.  I'm not clear on what exactly you
mean -- do you mean that I should continue to use
table.writeSelectedRows, but manually keep track of the current vertical
displacement from the top of the page for the current row and decide if
I need to break the page using logic similar to what's in fitPage?

  return table.getTotalHeight() <= indentTop() - currentHeight -
indentBottom() - margin;


If so, it sounds like I would need to calculate the height of the row
before adding it (since the row could be one or more lines tall)

Is there an example in the iText example source package that I can look
at for this concept?


Thank you!

Daniel Wellman

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 21, 2004 6:30 PM
To: Wellman, Daniel; [EMAIL PROTECTED]
Subject: Re: [iText-questions] PDFPTable page splitting issues

Do your own layout. After all, you are already using
writeSelectedRows(),
you don't need fitsPage().

Best Regards,
Paulo Soares

----- Original Message -----
From: "Wellman, Daniel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 21, 2004 19:11
Subject: [iText-questions] PDFPTable page splitting issues


First off, thank you for creating such an excellent tool and for
providing a great community mailing list.  We are evaluating iText for
use in a project and are working on a proof-of-concept that involves the
following:
-          Headers and foots on every page
-          All the content is stored in a table to provide clean rows
and columns of data (no nested tables)
-     Runs in a web application and sends response data to either the
local file system or to the HttpResponse

BACKGROUND:

We are doing this with PdfPTables for the content and page event
listeners for onEndPage to add headers and footers.  We use this method
as described in an earlier list message to determine if we have
surpassed our page boundary when iterating through our list of data to
print to the PDF file:

         // add content to table with addCell(Phrase) omitted here
         if (!writer.fitsPage(table, myMargin)) {
            table.deleteLastRow();
            i --;    // decrement our loop counter to reprint the last
row on the new page
            table.writeSelectedRows(0, -1,document.leftMargin(),
marginInfo, writer.getDirectContent());
            document.newPage();
            table = createTable(reportLayoutObject,tableCellLengths);
        }

Note that in this case, we have one collection of all of the data to be
rendered, where each element contains one row of data.  This works
perfectly, as far as we can tell.

PROBLEM:
Now we are facing a problem on a different report which does something
like this:
            Print a label row (i.e. "List of Foos:")
            Loop through a collection of foo data and print out as in
the previous example
            Print another label row (i.e. "List of Bars:")
            Loop through a collection of bar data...
            etc.

The problem I see here is that we only catch the write-past-end-of-page
condition when we are looping through a collection of data to print.
Printing the label rows runs the risk of printing beyond the page end;
if we try and call writer.fitsPage() and deleteLastRow() afterwards,
there's no way to get this label Row data back to reprint it.

This is similar to the problem/feature suggestion noted here:
http://sourceforge.net/mailarchive/message.php?msg_id=6510263

...

Thanks for your advice!
Daniel Wellman



---------------------------------------------------------------------

The message contains confidential and/or legally privileged

information and is intended for use by the indicated addressee. 



If you are not the intended addressee: (a) any disclosure,

reproduction, distribution or action you take because of it is

strictly prohibited; (b) please return the complete message to the

sender; and (c) this message is not a solicitation for purchase or

sale or an agreement of any kind whatsoever that binds the sender.

---------------------------------------------------------------------


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to