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
vote
0 answers

Create jsp page with html to pdf

I am doing a jsp project where the user adds questions(say he has added 20 questions)using tinymce and this questions are sent to the mysql database.Next this questions need to be printed on a pdf directly from the database. I have already done most…
user1932600
  • 57
  • 3
  • 13
1
vote
2 answers

How do I change a header cell when the page changes?

I have a PdfPTable in my document being written using iTextSharp. There are some header rows which get repeated whenever the table overflows to another page. One of those rows contains a cell with some text, e.g. "John Doe". What I want is for that…
Jeff Yates
  • 61,417
  • 20
  • 137
  • 189
1
vote
1 answer

Inserting fillable fields in a table [iText]

I have just spent a bit of time figuring out how to insert fillable fields into a PdfPTable using iText. Through reading the book and googling, I knew that fields should be added via direct content, and as I needed to add fields to specific cells…
1
vote
1 answer

How to set width for PdfPTable and align table center in page

i'm starter in iTextSharp, i write this code for create RoundRectangle into PdfPTable and align table in page center string pdfpath = Server.MapPath("PDFs"); RoundRectangle rr = new RoundRectangle(); using (Document document = new…
Pouya
  • 1,908
  • 17
  • 56
  • 78
0
votes
0 answers

how to create printable pdf which prints only inputed data?

I have a editable PDF, I want to take print of it but i want only the data entered by end user will be print only not the other content of the PDF, How can i do this?
Ram Singh
  • 6,664
  • 35
  • 100
  • 166
0
votes
1 answer

iTextSharp: Need help to repeat some columns in the 1st row of the table after page break

I am creating a PDF document using iTextSharp. The document is a bunch of tables. Some of the tables span over a few pages. First column is a date. If several rows of the table has the same date in 1st column, only I output date only in the first…
Sergey
  • 1
0
votes
1 answer

How to put database records into an iText pdf table report in Java

So I want to connect my records into an iText table report. I managed to just list all my records inside the PDF but not putting them inside a table. if (option.equals("Download all records.")) { Statement stmt = conn.createStatement(); …
japmanw13
  • 1
  • 1
  • 2
0
votes
1 answer

Itext java pdfptableevent rounded corners background multiple pages

I am using itext 4.2 java to generate pdf and want to have rounded corners with background color and I am able to accomplish it as well. I face one issue the first column was alone getting rounded corner and background so inorder to fix it ,I need…
bigler
  • 9
  • 3
0
votes
1 answer

iText - setSplitRows issue

I'm trying to generate iText PDF report using PdfPTable. There is an issue with table rows. I don't want to have a splitted row between two pages so I set up a table.setSplitRows(false); but one of my rows in the table has been removed (or is…
sticker
  • 83
  • 8
0
votes
1 answer

When creating a pdf with itextpdf -PdfPTable while adding table in any of a row it's displaying a dark border at bottom

While creating a table through itextpdf getting a dark border in a certain cell. But I have not specified any border had set only border color to gray. Getting this only while viewing the PDF in Adobe Reader in 100% zoom. if zoom size is increased…
0
votes
1 answer

Data not showing when using PdfPTable in Itext Report

I am building an itext report with nested PdfPTables. I have been able to verify that the data is getting from the database to my data objects, but I have not been able to get that data to show up in the body of the report. The Header, which I had…
Charles
  • 355
  • 1
  • 2
  • 12
0
votes
0 answers

Customizing align PdfPTable in iText 2.1.7

I'm using iText 2.1.7 and I am new to iText; I want to know can we custom align table: I have already tried using (.setHorizontalAlignment(Element.ALIGN_LEFT)) but my table is starting from quite left I want to align it with my other table //…
0
votes
0 answers

how to create pdf document from jTable witch contains multiple rows and pages using java?

I want to export jTable (tblinvoice) (16 columns) data to a A4 sized pdf document using iText 5 and Java. the pdf might have multiple pages and each page should have table header and page number. I have one jTable with 16 columns. Im trying with…
0
votes
1 answer

Can you determine column-width in iText based on input (e.g. a string)?

I am working on a project using iText and Java. In the project, I will be making a pdf. In this pdf, there will be multiple tables and they will have changing column counts and content, which means the column-widths have to be determined in a…
Mr. Nielzom
  • 317
  • 1
  • 2
  • 11
0
votes
0 answers

Dynamically how to generated multiple table as a Json Data requirement in itextpdf

Generated multiple table in itextpdf. below given Json Format: { "status": 1, "challan": [ { "Cmp_Name": "ABC", "Partyid": "18", "ChallanNo": "-", "PartyName": "PURCHASE MH", …
Kanan
  • 167
  • 1
  • 2
  • 10