I'm using a modified version of the memory saving technique presented in the tutorial to print a huge table out. I run the fitsPage code and it says it fits the page, so I continue on. The next line says it does not fit, so I delete the row, print the table, and then say newPage. The output is such that I get the table printed, a line of the table on the next page, and THEN a table break. Could this be a bug in fitsPage?
Here's the code: private void renderGenericTableElement ( ITableElement table, java.util.List headers, java.util.List content, TableProperties properties, Vector annotations ) throws DocumentException, InterruptedException { // Title String title = table.getTitle() ; // If there are no headers or content, then the table is presumed to be blank. Simply // Return the title, if any. if ( null == headers && null == content ) { if ( null == title ) return ; Paragraph p = new Paragraph ( title, TABLE_TITLE2_FONT ) ; addAnnotations(p, annotations) ; iTextDoc.add(p); return ; } PdfPTable rendering = startGenericTable ( headers, title, properties, annotations, true ) ; // Start adding content. Break on page boundaries for memory management. int contentSize = content.size() ; int rowsDrawn = 0 ; for ( int i = 0 ; i < contentSize ; i++ ) { addGenericRow ( rendering, (java.util.List)content.get(i), properties, i ) ; // Start a new page if it won't fit if ( ! writer.fitsPage(rendering) ) { // If the table has minimumRowsBeforePageBreak set, then check to see if the // line count is greater than the keep together. If it does, and the // number of lines drawn is less than the keep together, break the // page. if ( properties.minimumRowsBeforePageBreak > 0 && rowsDrawn < properties.minimumRowsBeforePageBreak ) { iTextDoc.newPage() ; if ( ! writer.fitsPage(rendering) ) { // If it still doesn't fit the page, delete the last line rendering.deleteLastRow() ; i-- ; iTextDoc.add(rendering); iTextDoc.newPage() ; rendering = startGenericTable(headers, title, properties, null, false); rowsDrawn = 0 ; } } else { // No keep together, end the page. rendering.deleteLastRow(); i--; iTextDoc.add (rendering); iTextDoc.newPage(); rendering = startGenericTable ( headers, title, properties, null, false ) ; rowsDrawn = 0 ; } } rowsDrawn++ ; } iTextDoc.add(rendering); } The startGenericTable method creates a new table. The addGenericRow code creates a new row's worth of cells from our data format. Any thoughts? Thanks, Bill -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Paulo Soares Sent: Thursday, October 16, 2003 9:46 AM To: 'Bill Simpson'; [EMAIL PROTECTED] Subject: RE: [iText-questions] Switching Page Orientations {Scanned} The changes will only show after open() and newPage(). The content has nothing to do with it. Best Regards, Paulo Soares > -----Original Message----- > From: Bill Simpson [SMTP:[EMAIL PROTECTED] > Sent: Thursday, October 16, 2003 17:40 > To: [EMAIL PROTECTED] > Subject: [iText-questions] Switching Page Orientations {Scanned} > > I have an application that dynamically determines page orientation, and > sets the page size BEFORE any content is written to the page. Sometimes > the page orientation switch works fine, sometimes it doesn't. Any > thoughts? Has anyone else experienced this? I am using page events, as > well as an outline, though I'm fairly confident that I am changing the > orientation before any of these items are used. > > Thanks. ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions