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

how to export the contents of a filtered jTable to a pdfpTable

I have a JTable and am using JFilter to filter its contents based on user input. Now i intend to export the contents of the JTable to a PdfPTable using iText library. The contents do not get copied correctly while using the filter.However the table…
pranay
  • 2,339
  • 9
  • 35
  • 58
0
votes
0 answers

Horizontal alignment on row PdfPRow itextsharp (c#)

Need some help here. I'm trying text within a row looks in the same horizontal line as it's corresponding dotted lines This is the result And this is the part of my code related to the image: Font coverHeaderFont = new…
0
votes
0 answers

Special characters throwing error in ITextSharp

ITextSharp is used in my application for viewing the data from the database in a pdf format. Document document = new Document(PageSize.A4); MemoryStream stream = new MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(document, stream); …
Kesiya Abraham
  • 753
  • 3
  • 10
  • 24
0
votes
0 answers

Pdfptable cuts into page while using three tables and WriteSelectedRows

While using PdfPTable by iTextsharp, we are facing an issue where the scenario is that there are three tables added one after the other in a document such as: tblEstimate.WriteSelectedRows(0, -1, 15, 675, cb); // cb :…
0
votes
1 answer

iText 5 resizes the page when I add a Table spanning across pages

I have set the document size to A4 with the following code initially document.setPageSize(PageSize.A4) but when I try to add a table spanning across multiple pages it resizes the page size to 8.2x11.69. Is this the correct reason why the page is…
ravi.sankar.ch
  • 113
  • 1
  • 6
0
votes
1 answer

Repeated lines in PdfPTable at the end of the page?

I'm using a PdfPTable (iText) to print a table that is populated with some list of values. The problem is that, in the case where the PdfPTable takes more than one page to be displayed, its last line is printed at the end of the first page and ALSO…
Sinda MOKADDEM
  • 796
  • 2
  • 12
  • 35
0
votes
0 answers

How can I repeat the header rows of an ITextPDF PdfPTable on each page?

`table.setHeaderRows(1); The function setHeaderRows(1); will repeat the first row in all pages. But what should I do if I want to repeat some Columns in table in all pages? Any help please! I am using Itextpdf-5.5.10.jar The following is the…
0
votes
1 answer

document.add resize the document using iText

When I try to read an HTML file (using HTMLWorker.parseToList) and create a PDF document using document.add(element) the resulting page is getting resized. The initially set page size is getting overridden, it appears the page is resizing itself to…
Ajith Jose
  • 723
  • 2
  • 9
  • 22
0
votes
0 answers

Android: Reduce the width of a cell in PdfPTable

I have a PdfPTable for the footer of my PDF. The footer should contain three sentences one below the other. Also a Barcode Image should be there below this footer. In my current implementation, I am doing it in the following way: PdfPTable…
Exception
  • 2,273
  • 1
  • 24
  • 42
0
votes
1 answer

iText Table inside ColumnText don't keeptogether

I'm using iText 5.5.9. I have a PdfPTable that I show inside a ColumnText. The ColumnText has a small column and a large column. If the table is too large for the small column, it should move to the second, larger column. How can I do this? I tried…
Dalendrion
  • 69
  • 1
  • 13
0
votes
1 answer

PdfpTable nested in PdfpTable cell has white space on both sides

I have a main PdfpTable with one column I use as the parent table. I then add tables created with a dynamic # of columns to the parent table. So each table is a row in the parent table. I'm getting what I desired except for a few things: 1) The…
JWiley
  • 3,129
  • 8
  • 41
  • 66
0
votes
1 answer

Splitting table cells diagonally itextsharp

I am trying to use iTextSharp() for the first time, and I'm having an issue creating a table in a pdf document. Indeed, I want to split the first cell diagonally to write in the title of the first row and the title of the first column. Picture 1 is…
0
votes
1 answer

Write a title on itextPdf table border

I'm using iTextPdf to create a table on an android application. I need to have the title of the table on its upper border as shown on the image below. How can I achieve this? Thanks in advance
Shura Capricorn
  • 119
  • 1
  • 9
0
votes
0 answers

PdfPCell Number ontop of image

I would like to know if it is possible to put text on top of a image in a PDFPCell on ITextSharp. Thanks.
brunof.89
  • 150
  • 1
  • 7
0
votes
1 answer

Assign Dynamic PdfPCell width to dynamically generated PdfPCell

I am using iTextSharp version 5.4.5.0. I am trying to print PdfPTable with Multiple PdfPCell. The Number of PdfPCell will be dynamic. So How can I assign width to the dynamically generated PdfPCell ? I know how to assign width to Static and Fixed…
Herin
  • 704
  • 3
  • 18
  • 34