Quoting Ken Gentry <[EMAIL PROTECTED]>:
Sorry for not including a test app. It was the end of a 14 hour day of
development and my brain was cloudy :-(
The attached app and generated output very closely mimic what our
software framework is generating.
Any help is greatly appreciated.
I don't see my answer appear on the list.
I'm working on a public computer using webmail.
Maybe I've made a mistake. Anyway, in attachment
you'll find a solution (not the only solution,
not the most elegant solution, but it works).
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chapter;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Section;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class TableNewPageParagraph {
public static final String RESULT = "newpage.pdf";
public static void main(String[] args) {
// step 1
Document document = new Document();
try {
// step 2
PdfWriter.getInstance(document, new FileOutputStream(RESULT));
// step 3
document.open();
// step 4
PdfPTable table = new PdfPTable(2);
table.getDefaultCell().setUseAscender(true);
table.getDefaultCell().setUseDescender(true);
for (int i = 0; i < 150; i++) {
table.addCell("cell " + i);
}
Chapter chapter = new Chapter("Chapter with table", 1);
chapter.add(table);
chapter.add(Chunk.NEXTPAGE);
chapter.add(new Paragraph("Hey, this is a new page!"));
Section section = chapter.addSection(new Paragraph("Hey, this is a new section!"));
table = new PdfPTable(3);
for (int i = 0; i < 1200; i++) {
table.addCell("cell " + i);
}
section.add(table);
section.add(Chunk.NEXTPAGE);
section.add(new Paragraph("Hey, this is also a new page!"));
section.add(new Paragraph("All this was kept in memory until document.add(chapter)"));
document.add(chapter);
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5
document.close();
}
}
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar