Hi,

In the PDF document that I am creating, I have to position a table at a
particular y-position on the page. The number of rows of the table can vary
depending upon some context of my applicaton. In the documentation it is
mentioned that if the table doesn't fit in a page it automatically gets split
and the overflow moves on to the next page. But it is not happening in my case.
Whatever numbers of rows that can fit on the page show up and the rest of the
table gets truncated. Please see the following sample code and let me know what
is wrong.

//...some code
float currentY = ... // Get the current Y-Position in the page.
PdfContentByte cb = writer.getDirectContent();

PdfPTable table = new PdfPTable(numOfCols);
PdfPTable table = new PdfPTable(numCols);
table.setHorizontalAlignment(Element.ALIGN_CENTER);
table.setWidths(hdrWidths);
table.setTotalWidth(document.right() - document.left());
table.getDefaultCell().setPadding(1);
table.getDefaultCell().setBorderWidth(1);       
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table.getDefaultCell().setNoWrap(true);
// Lot of table.addCell() statements written out using a for loop

table.writeSelectedRows(0, -1, document.left(), currentY, cb);

Table gets truncated if the table doesn't fit on the page. Thanks for your help.

Regards,
Nandu



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to