PDF .NET Library Logo

Creating Tables in PDF Documents

The following code snippet creates a table on a PDF document.

C# sample:

PDFDocument MyPDF = new PDFDocument("Tables.pdf");

Table table = new Table(2,2);

table.DisplayHeader = true;

table.column(0).header.SetValue("Name");

table.column(1).header.SetValue("Surname");

table.cell(0, 0).SetValue("John");

table.cell(0, 1).SetValue("Smith");

table.cell(1, 0).SetValue("Joe");

table.cell(1, 1).SetValue("Doe");

MyPDF.CurrentPage.Body.DrawTable(table);

MyPDF.Save();

Back to PDF Code Library