class ProductRequestPage2 extends PdfPageEventHelper
public void onEndPage(PdfWriter writer, Document document) {}
Table table = new Table(1);table.setWidth(100);
table.setTableFitsPage(true);
table.setBorderWidth(0);
table.setBorder(0);
table.getDefaultCell().setBorder(0);
table.setOffset(5);
Cell secondCell = new Cell(new Phrase("", new Font(bf2, 9)));
table.addCell(secondCell);
secondCell = new Cell(new Phrase("Global Export Control ", new Font(bf2, 9)));
secondCell.setBackgroundColor(new Color(0xC1, 0xC0, 0xC0));
secondCell.setHorizontalAlignment(Element.ALIGN_LEFT);
secondCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
secondCell.setLeading(9);
table.addCell(secondCell);//Line no 1675
堆栈追踪:
Caused by: java.lang.StackOverflowError
at com.lowagie.text.pdf.events.PdfPageEventForwarder.onEndPage(Unknown Source) ~[itext-2.1.7.jar:?]
at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source) ~[itext-2.1.7.jar:?]
at com.lowagie.text.pdf.PdfDocument.carriageReturn(Unknown Source) ~[itext-2.1.7.jar:?]
at com.lowagie.text.pdf.PdfDocument.add(Unknown Source) ~[itext-2.1.7.jar:?]
at com.ocr.pcs.action.ProductRequestPdf$ProductRequestPage2.onEndPage(ProductRequestPdf.java:1675) ~[?:?]
at com.lowagie.text.pdf.events.PdfPageEventForwarder.onEndPage(Unknown Source) ~[itext-2.1.7.jar:?]
at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source) ~[itext-2.1.7.jar:?]
答案 0 :(得分:0)
您是否使用此代码创建了新页面?您的表适合页面并具有偏移量,尝试使其略小于页面