PDF Table Generator
The Documentize Table Generator 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 TableGenerator
class:
- Configure the
TableOptions
object to define table structure, content, and input/output files. - Add tables, rows, and cells to your PDF.
- Finalize the table generation process using the
Process
method.
Here’s an example:
1var options = new TableOptions();
2
3// Specify input and output PDF files
4options.AddInput(new FileDataSource("input.pdf"));
5options.AddOutput(new FileDataSource("output.pdf"));
6
7// Define a table with rows and cells
8options
9 .InsertPageBefore(1) // Add table before the first page
10 .AddTable()
11 .AddRow()
12 .AddCell().AddParagraph("Cell 1")
13 .AddCell().AddParagraph("Cell 2")
14 .AddCell().AddParagraph("Cell 3");
15
16// Generate the table in the document
17TableGenerator.Process(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();
2
3// Specify input and output PDF files
4options.AddInput(new FileDataSource("input.pdf"));
5options.AddOutput(new FileDataSource("output.pdf"));
6
7// Define a table with rows and cells
8options
9 .InsertPageAfter(2) // Add table after page 2
10 .AddTable()
11 .AddRow()
12 .AddCell().AddParagraph("Cell 1")
13 .AddCell().AddParagraph("Cell 2")
14 .AddCell().AddParagraph("Cell 3");
15
16// Generate the table in the document
17TableGenerator.Process(options);
Processing the Table Generation
After adding all content and customizing the table structure, finalize the process by calling the Process
method. This method generates the tables and updates the PDF document. Here’s how to handle the results:
1var resultContainer = generator.Process(options);
2
3// Output the number of generated results
4Console.WriteLine("Number of results: " + resultContainer.ResultCollection.Count);
Key Features:
- Dynamic Table Creation: Effortlessly generate structured tables in PDF documents.
- Rich Content Support: Populate tables with text, HTML, images, and LaTeX content.
- Page Placement: Insert tables at specific locations within a PDF with precision.
- Customizable Layout: Adjust table structure, cell alignment, and styling.