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
0
votes
1 answer

Adding a radio button in PDFPCell iTextSharp

I am trying to add a radio button in itextsharp's pdfpcell. this is my code: var rf1 = new RadioCheckField(writer, new Rectangle(10,10), "cellRadioBox", "Yes"); rf1.Checked = true; rf1.CheckType = RadioCheckField.TYPE_CHECK; PdfFormField field =…
0
votes
0 answers

iTextSharp table on every page

I need to make a PDF document with a table containing multiple rows and columns that shows client information. I also need to show the products of this client. I create a loop which creates a new table with multiple rows and columns and the product…
Paul Meems
  • 3,002
  • 4
  • 35
  • 66
0
votes
1 answer

DefaultCell properties are not used in my pdf created with iTextSharp

I use iTextSharp v5.5.6 I'm creating a large table. To be consistent in my layout I want to use the DefaultCell class to set some default settings like font, padding and alignment. I'm not doing something correct because the settings are not…
Paul Meems
  • 3,002
  • 4
  • 35
  • 66
0
votes
1 answer

itextsharp underlined text in cell falls outside cell

I have been able to create a PDF using iTextSharp in my VB .net code that looks almost exactly as I want it to. However, I am using a table with one column and multiple rows to display long text strings put together by using chunks and phrases. Some…
jencarta
  • 15
  • 4
0
votes
0 answers

iText Can you use PdfPTable with HtmlWriter

I am working on a legacy java web application. The application uses iText 2.0.1. They do not want to upgrade the version of iText so I have to continue using this one. I need to output to either pdf or html. I am creating a PdfPTable. I create a…
Greg
  • 57
  • 1
  • 2
  • 7
0
votes
0 answers

table.addCell (cell) using itext pdfptable scroll vertically instead of horizontally on the table

I get a list of the column items. When I add the items separately in a repeating loop to a cell. The column data is displayed online. Is there any way for the inclusion of addCell data (cell) occurs vertically (by columns) and not horizontally (by…
Paulo Victor
  • 327
  • 1
  • 4
  • 12
0
votes
0 answers

C# iTextSharp: split table

i got my pdf like this. https://drive.google.com/a/mahidol.edu/file/d/0B9vSVV3dDAmFZDkwWXdfYWNDc2M/view first, on Page 1 i use rowspan on the first column when it splited, bottom line not be equal. i want the line to be equal. second, on Page 2 when…
0
votes
1 answer

How can I get my PdfPTable's border and background color to display (iTextSharp)?

As you can see, I've got a table which sports borders and a background color (Section 1): ...but section 3 lacks these sartorial refinements, and I don't know why. Here is the pertinent code for section 1 (which displays as it should): PdfPTable…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
0
votes
1 answer

How can I create buttons to add to a PDF file using iTextSharp?

I'm creating "labels" and textboxes and checkboxes using iTextSharp, but my attempts to derive from that code to create buttons has not yet been successful. Here is how I'm creating textBoxes: PdfPCell cellRequesterNameTextBox = new PdfPCell() { …
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
0
votes
1 answer

dataGridView to pdf with itextsharp

I have a problem while trying to get values of specific columns in dataGridView and add them to the PdtPtable. But the values added in the table is repeated, for example row one is added twice.I tried to go through each row and in every row through…
Erduan
  • 1
  • 2
  • 1
0
votes
0 answers

itext repaint borders of a table

I write a pdfptable to a document and than I add an header table and a footer table using onStartPage events. My problem is that if the main table has a top border this will partially overwritten by the header. The naive solution is to write the…
Neo
  • 1,337
  • 4
  • 21
  • 50
0
votes
2 answers

Itext LargeElement and splitRows option

I'm trying to create a pdf containing a big table with itext v5.5.3. I need : memory management repeating headers (1 row) disabling rows split With the code below, everything works fine : Document document = new Document(PageSize.LETTER); …
z8manu8z
  • 15
  • 1
  • 6
0
votes
1 answer

iText: Image in PdfpCell setAbsolutePosition does NOT work

I have a PdfPTable with 6 PdfPCell. I want to put an image in each cell at an absolute position. I just can get it to work, what am I doing wrong? As shown in the pic, the image always show on the to left (default)…
topcan5
  • 1,511
  • 8
  • 30
  • 54
0
votes
0 answers

Text without wrap in PdfPtable in iText/Java

i have a problem with the PdfPTable in iText (Version 4.2.0). I calculate the maximun width for each column (depends on the entrys on this place). After this i give the method PdfPTable.setWidths() these values. Now the problem, if i have to many…
Manu Zi
  • 2,300
  • 6
  • 33
  • 67
0
votes
0 answers

Unable to convert HTML text into PdfPCell using itextpdf

I'm trying to display a HTML string in the PdfPTable using itextpdf. Here's what I have done: String solution = "

some text

"; Phrase htmlPhrase = new Phrase(": ", fontNormal10); StyleSheet styleSheet = new…
talha06
  • 6,206
  • 21
  • 92
  • 147