I am currently working on a program that has to write nice PDFs, and I'm using the iText library to do this.
I am nearly done, except for some major layout problems.
1. iText automatically splits tables up if it reaches the end of the page, and continues on the next one. Neither in the methods nor in the documentation I could find a way to prevent this. I have lots of quite small tables, if everyone of them is split up the whole thing is unreadable.
Table tab = new Table(2); Image logo = Image.getInstance("Y:\\wsp2.gif"); logo.scalePercent(70); Cell logoCell = new Cell(logo); logoCell.setHorizontalAlignment("RIGHT"); //the picture is left anyway tab.addCell(logoCell); PdfPTable pdftab = new PdfPTable(2); tab.setConvert2pdfptable(true); pdftab = tab.createPdfPTable(); logo.scalePercent(50); pdftab.addCell(logo); //this picture doesnt even show up. pdftab.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin()); pdftab.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(), writer.getDirectContent());
I have marked the lines that basically got ignored, i have no idea why. I don't really get the difference between Table and PdfPTable anyway, why have 2 models?
Thank you very much in advance,