Add Table

The Documentize PDF Manager for .NET is a versatile plugin designed to streamline the integration of tables into PDF documents. Whether you’re organizing data, designing forms, or improving document readability, this plugin simplifies the process while maintaining precision and efficiency. Its intuitive API supports both single document and batch processing workflows, making it an essential tool for developers working with structured data.

Creating a PDF with Tables

Follow these steps to create structured tables in a PDF using the TableOptions class:

  1. Configure the TableOptions object to define table structure, content, and input/output files.
  2. Add tables, rows, and cells to your PDF.
  3. Finalize the table generation process using the AddTable method.

Here’s an example:

 1// Configure table options
 2var options = new TableOptions();
 3options.InsertPageBefore(1)
 4   .AddTable()
 5        .AddRow()
 6            .AddCell().AddParagraph("Name")
 7            .AddCell().AddParagraph("Age")
 8        .AddRow()
 9            .AddCell().AddParagraph("Bob")
10            .AddCell().AddParagraph("12")
11        .AddRow()
12            .AddCell().AddParagraph("Sam")
13            .AddCell().AddParagraph("20")
14        .AddRow()
15            .AddCell().AddParagraph("Sandy")
16            .AddCell().AddParagraph("26")
17        .AddRow()
18            .AddCell().AddParagraph("Tom")
19            .AddCell().AddParagraph("12")
20        .AddRow()
21            .AddCell().AddParagraph("Jim")
22            .AddCell().AddParagraph("27");
23// Add input file path
24options.AddInput(new FileDataSource("path_to_input.pdf"));
25// Set output file path
26options.AddOutput(new FileDataSource("path_to_output.pdf"));
27// Perform the process
28PdfManager.AddTable(options);

Set page of the table

Follow these steps to create table in a PDF after 2 page: Here’s an example:

 1var options = new TableOptions();
 2options.InsertPageBefore(2) // Add table before page 2
 3   .AddTable()
 4        .AddRow()
 5            .AddCell().AddParagraph("Name")
 6            .AddCell().AddParagraph("Age")
 7// Add input file path
 8options.AddInput(new FileDataSource("path_to_input.pdf"));
 9// Set output file path
10options.AddOutput(new FileDataSource("path_to_output.pdf"));
11// Perform the process
12PdfManager.AddTable(options);

Key Features:

  • Dynamic Table Creation: Effortlessly generate structured tables in PDF documents.
  • Page Placement: Insert tables at specific locations within a PDF with precision.
  • Customizable Layout: Adjust table structure, cell alignment, and styling.