Hello Jens,

please subscribe to the mailing list.
If you don't, you risk this scenario: http://lowagie.com/itextml

As for your question, I assume you don't want the first table to be 
extended.
In that case, you should adapt your code like this:

import java.io.FileOutputStream;
import com.itextpdf.text.Document;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;

public class PDFTest {

      public static void main(String args[]) {
          try {
              Document d = new Document(PageSize.A4, 0, 0, 0, 0);
              String filename = "pdf.pdf";;
              PdfWriter.getInstance(d, new FileOutputStream(filename));
              d.open();
              PdfPTable table = new PdfPTable(2);
              PdfPCell cell = new PdfPCell();
              cell.addElement(getTable(3));
              table.addCell(cell);
              cell = new PdfPCell();
              cell.addElement(getTable(5));
              table.addCell(cell);
              d.add(table);
              d.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
      }

      private static PdfPTable getTable(int rows) {
          PdfPTable table = new PdfPTable(1);
          for (int i = 0; i < rows; i++) {
              PdfPCell cell = new PdfPCell(new Phrase("test"));
              table.addCell(cell);
          }
          table.setWidthPercentage(100);
          table.setExtendLastRow(false);
          return table;
      }
}

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to