There seems to be a problem with nested PdfPTable and PdfPCell setRotation.

When running the following example, a table with no content is generated.

If the setRotation is changed to 180 or removed completely, the the output is
correct.

import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;

public class Rotating {

        public static void main(String[] args) {

                Document document = new Document(PageSize.A4);
                try {
                        PdfWriter writer = PdfWriter.getInstance(document,
                                        new FileOutputStream("Rotating.pdf"));
                        document.open();

                        PdfPTable table = new PdfPTable(1);
                        PdfPTable t1 = new PdfPTable(2);
                        t1.addCell("c0");
                        t1.addCell("c1");
                        t1.addCell("c2");
                        t1.addCell("c3");
                        PdfPCell c0 = new PdfPCell();
                        //the next line is the responsible!!!
                        c0.setRotation(90);
                        c0.addElement(t1);
                        table.addCell(c0);
                        document.add(table);

                } catch (Exception de) {
                        de.printStackTrace();
                }
                document.close();
        }
}



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to