Hi Bruno and others,

I'm sorry if this question has been answered before, but my searches in the
archive didn't reveal a solution.

We have a document containing a few Paragraphs, containing Phrases,
PdfPTables and Images.
Depending on the content we want some paragraphs contained on the same page.

Maybe we haven't chosen the ideal approach for this layout, if so please
advise a better solution.

We're using iText 2.1.7 , the document structure is as follows:

Document > Paragraph > PdfPTable

If the Paragraph object has KeepTogether enabled the table is not rendered,
if this is false the table appears in the PDF.

This is a minimal code snippet that reproduces the problem.

                Paragraph p1 = new Paragraph();
>                 p1.setKeepTogether(false);
>                 p1.add(new Phrase("KeepTogether=FALSE"));
>
>                 Paragraph p2 = new Paragraph();
>                 p2.setKeepTogether(true);
>                 p2.add(new Phrase("KeepTogether=TRUE"));
>
>                 PdfPTable t1 = new PdfPTable(2);
>                 t1.setWidths(new int[]{50,50});
>                 t1.setWidthPercentage(100);
>                 PdfPCell c1 = new PdfPCell(new Phrase("Left"));
>                 c1.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
>                 PdfPCell c2 = new PdfPCell(new Phrase("Right"));
>                 c2.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
>                 t1.addCell(c1);
>                 t1.addCell(c2);
>
>                 p1.add(t1);
>                 p2.add(t1);
>


>                 document.add(p1);
>                 document.add(p2);
>

Thanks in advance!

Kind regards,

Jo Voordeckers

-- 
- Jo
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
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