We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create table in a PDF file?

Platform: WinForms |
Control: PDF

Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can create a table in PDF documents in C# and VB.NET.

Essential PDF allows you to create the table with data sources from DataSet, data table, arrays and IEnumerable objects using PdfLightTable class along with simple formatting. You can directly add rows and columns, instead of a data source by setting the DataSourceType property to TableDirect.

Steps to create table in a PDF file programmatically:

  1. Create a new console C# application project. Create Console application in Visual Studio
  2. Install the Syncfusion.Pdf.WinForms NuGet package as reference to your .NET Framework applications from NuGet.org. Install nuget packages
  3. Include the following namespaces in Program.cs file.


using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Tables;
using System.Drawing;



Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Graphics
Imports Syncfusion.Pdf.Tables
Imports System.Drawing


  1. Use the following code snippet to create table in a PDF file.


//Create a new PDF document
using (PdfDocument document = new PdfDocument())
  //Add a page
  PdfPage page = document.Pages.Add();
  //Acquire pages graphics
  PdfGraphics graphics = page.Graphics;
  //Declare a PdfLightTable
  PdfLightTable pdfLightTable = new PdfLightTable();
  //Set the Data source as direct
  pdfLightTable.DataSourceType = PdfLightTableDataSourceType.TableDirect;
  //Create columns
  pdfLightTable.Columns.Add(new PdfColumn("Roll Number"));
  pdfLightTable.Columns.Add(new PdfColumn("Name"));
  pdfLightTable.Columns.Add(new PdfColumn("Class"));
  //Add rows
  pdfLightTable.Rows.Add(new object[] { "111", "Maxim", "III" });
  //Draw the PdfLightTable
  pdfLightTable.Draw(page, PointF.Empty);
  //Save the document



'Create a new PDF document
Using document As PdfDocument = New PdfDocument()
 'Add a page
  Dim page As PdfPage = document.Pages.Add()
  'Acquire pages graphics
  Dim graphics As PdfGraphics = page.Graphics
  'Declare a PdfLightTable
  Dim pdfLightTable As PdfLightTable = New PdfLightTable
  'Set the Data source as direct
  pdfLightTable.DataSourceType = PdfLightTableDataSourceType.TableDirect
  'Create columns
  pdfLightTable.Columns.Add(New PdfColumn("Roll Number"))
  pdfLightTable.Columns.Add(New PdfColumn("Name"))
  pdfLightTable.Columns.Add(New PdfColumn("Class"))
  'Add rows
  pdfLightTable.Rows.Add(New Object() {"111", "Maxim", "III"})
  'Draw the PdfLightTable
  pdfLightTable.Draw(page, PointF.Empty)
  'Save the document
End Using


A complete working sample can be downloaded from Create-PDF-Table.zip

By executing the program, you will get the PDF document as follows. Create Table in PDF File

Refer here to create a table in PDF using PdfGrid and know the  differences between PdfLightTable and PdfGrid.

Take a moment to peruse the documentation, where you can find other options like drawing right-to-left text and multi-column text, consuming TrueType fonts, Standard fonts, and CJK fonts. Also, the features like PDF form filling, extract text or images from PDF, and protect PDF documents with code examples.

Refer here to explore the rich set of Syncfusion Essential PDF features.

An online sample link to create table in a PDF file.


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment
Wissem Souissi
Aug 07, 2019

How could I get all tables in syncfusion.pdf.pdfdocument ?


Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile