Create a Table in a PDF Using Java Last Updated : 04 Nov, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The creation of a table in a PDF using Java is done by installing the document class. While instantiating this class, pass a PdfDocument object as a parameter to its constructor. Then, to feature a table to the document, instantiate the Table class, and add this object to the document using the add() method. Note: External jar files are required to perform operations on PDF. Below is an example PDF adding a table in a pdf using java with all the steps: Java // Adding table in a pdf using java import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.layout.Document; import com.itextpdf.layout.element.Cell; import com.itextpdf.layout.element.Table; public class AddingTableToPDF { public static void main(String args[]) throws Exception { String file = "C:/EXAMPLES/itextExamples/addingTableToPDF.pdf"; // Step-1 Creating a PdfDocument object PdfDocument pdfDoc = new PdfDocument(new PdfWriter(file)); // Step-2 Creating a Document object Document doc = new Document(pdfDoc); // Step-3 Creating a table Table table = new Table(2); // Step-4 Adding cells to the table table.addCell(new Cell().add("Name")); table.addCell(new Cell().add("Raju")); table.addCell(new Cell().add("Id")); table.addCell(new Cell().add("1001")); table.addCell(new Cell().add("Designation")); table.addCell(new Cell().add("Programmer")); // Step-6 Adding Table to document doc.add(table); // Step-7 Closing the document doc.close(); System.out.println("Table created successfully.."); } } Output: Comment More infoAdvertise with us Next Article Shrinking the Contents in a PDF using Java M mayanktyagi1709 Follow Improve Article Tags : Java Java Programs Practice Tags : Java Similar Reads Adding Images to a Table in PDF using Java PDFBox is an open-source library which is written in Java. It helps in the development and conversion of PDF Documents. PDFBox library comes in form of a JAR file. It can create new PDF documents, manipulate existing documents, bookmark the PDF and also extract content from PDF documents. We can use 7 min read Rotating an Image in a PDF Document Using Java In this article, we will learn how to  Rotating an Image in a PDF document using Java. For  Rotating an Image in a PDF, we will use the iText library. These are the steps that should be followed to  Rotating an Image in a PDF using java. 1. Creating a PdfWriter object The PdfWriter class represents 3 min read Formatting the Text in a PDF using Java We can add nested tables to a PDF by installing the document class. Following are the steps to format the text in a PDF using java. 1. Create a PDF writer object The PdfWriter class here represents the DocWriter for a PDF. This class belongs to the package com.itextpdf.kernel.pdf. The constructor of 3 min read Adding Nested Tables to a PDF using Java We can add nested tables to a PDF by installing the document class. While instantiating this class, you would like to pass a PdfDocument object as a parameter, to its constructor. Then, to feature a table to the document, you would like to instantiate the Table class and add this object to the docum 4 min read Shrinking the Contents in a PDF using Java Program to shrink the contents of a PDF document. The external jar file is required to import in the program. Below is the implementation for the same. Approach: 1. Create an empty PDF file. Assign the path of the empty PDF to a String variable.Import PdfWriter from the package com.itextpdf.kernel.p 5 min read Formatting the Content of a Cell in a Table of PDF using Java iText is a Java library developed, to access and manipulate PDF files, that is to extract and modify the PDF content. iText is a Java library originally created by Bruno Lowagie which allows creating, reading, and manipulating PDF files. Java allows incorporating various fully developed packages and 4 min read Like