Hi there,

i use a PdfPTable to prevent a page break between a header and the 1st
paragraph, and that works well.

But there is a problem in one case, where the PdfPTable fits well into
the first page, and even i end with
        doc.add(table);
        document.close();
an empty page will be added to the document, even there would be
enough left space to the doc.bottom(), shown by the blue line.

Here is my last try to build the PdfPTable, trying to set every
"space-consumer" to 0:

        private PdfPTable addParaToTable(Block ... blocks) throws 
ParseException {
                PdfPTable table = new PdfPTable(1);
                table.setSplitRows(false);
                table.setKeepTogether(true);
                table.setTotalWidth(doc.right() - doc.left());
                table.setLockedWidth(true);
                table.setSpacingAfter(0.0F);
                for (Block block : blocks) {
                        Style style = layout.getStyle(block.getType());
                        Paragraph para = 
createTextPara(addAttributeData(block), style);
                        PdfPCell cell = new PdfPCell();
                        cell.setPaddingTop(style.spaceBefore);
                        cell.setHorizontalAlignment(PdfContentByte.ALIGN_LEFT);
                        cell.setPaddingLeft(0.0F);
                        cell.setPaddingRight(0.0F);
                        cell.setPaddingBottom(0.0F);
                        cell.setBorderWidth(0.0F);
                        cell.addElement(para);
                        table.addCell(cell);
                }
                return table;
        }

Many thank for your help in advance!

Best regards,
Thomas

<<attachment: iText_prob.png>>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to