Ken Gentry wrote:
I don't get the page break.
I do, see attachments.
I am going nuts with this so any help would be greatly appreciated.
People saying "something doesn't work" without any proof for their allegations drive us crazy. Please adapt the attached example so that we can reproduce the problem. -- This answer is provided by 1T3XT BVBA
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chapter;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
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 < 1200; i++) {
table.addCell("cell " + i);
}
document.add(table);
document.newPage();
document.add(new Paragraph("Hey, this is a new page!"));
Chapter chapter = new Chapter("Chapter with table", 1);
table = new PdfPTable(3);
for (int i = 0; i < 1200; i++) {
table.addCell("cell " + i);
}
chapter.add(table);
document.add(chapter);
document.newPage();
document.add(new Paragraph("Hey, this is also a new
page!"));
document.add(new Paragraph("Whoever says newPage()
doesn't work, talks rubbish!"));
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5
document.close();
}
}
newpage.pdf
Description: Adobe PDF document
------------------------------------------------------------------------- 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
