Questions tagged [pdfptable]

Table class used by iTextPdf (iText and iTextSharp) versions 5.x for generating tables

PdfPTable is the class for creating tables in (Java) and (.Net).

This is a very simple example of its use:

/**
 * Example written by Bruno Lowagie and Nishanthi Grashia in answer to the following question:
 * https://stackoverflow.com/questions/24359321/adding-row-to-a-table-in-pdf-using-itext
 */
@WrapToTest
public class SimpleTable
{
    public static final String DEST = "results/tables/simple_table.pdf";

    public static void main(String[] args) throws IOException, DocumentException
    {
        File file = new File(DEST);
        file.getParentFile().mkdirs();
        new SimpleTable().createPdf(DEST);
    }

    public void createPdf(String dest) throws IOException, DocumentException
    {
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(dest));
        document.open();
        PdfPTable table = new PdfPTable(8);
        for(int aw = 0; aw < 16; aw++)
        {
            table.addCell("hi");
        }
        document.add(table);
        document.close();
    }
}

(101 - a very simple table)

Many more examples illustrating how to build more complex tables, can be found in the examples section of itextpdf.com.

107 questions
-1
votes
1 answer

How to confirm new word in itext pdfptable header takes new line?

I am using itext 2.1.7 library , and want to use that only. However I noticed whenever I create the PdfPTable which has the row headers of the table increase in words , they get scrambled. For Example , My table header : Total Power For…
Chetan
  • 1,141
  • 2
  • 15
  • 36
-2
votes
1 answer

A watermark image and table in itext - Edited

I want to insert a table over a watermark image. I have followed many steps but all help in writing over the image not inserting a table. Edit: the image should be inserted in each page in the pdf document. i want to write over it using pdfdTable.…
BDeveloper
  • 1,175
  • 6
  • 24
  • 44
1 2 3 4 5 6 7
8