|
I get the error
"java.lang.RuntimeException: The table width must be greater than
zero." when I call PdfPTable method writeSelectedRows(0, -1,
0,740, cb) but it works fine when I call Document .add(element) with the same
PdfPTable.
Any idea?
Here is the code (cb is PdfContentByte initialized
in the onOpenDocument method):
public void onStartPage(PdfWriter writer,
Document document)
{int amplada[] = {100}; try { cb.beginText(); cb.setTextMatrix(196,805); BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN,BaseFont.CP1252,BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf,8); cb.showText("ESTUDIANTS D'ESTADA TEMPORAL UB - MODALITAT INTERCANVI"); cb.endText(); PdfPTable t =
new PdfPTable(1);
t.setWidths(amplada); t.setWidthPercentage(100); t.addCell(new Phrase("CURS ACADEMIC")); document.add(t); // IT WORKS FINE t.writeSelectedRows(0, -1, 0,740, cb); // IT give the exception } catch (Exception e) {e.printStackTrace();} } |
- RE: [iText-questions] writeSelectedRows Jpenuela
- RE: [iText-questions] writeSelectedRows Paulo Soares
