Developer's Guide

HTML Converter

Convert HTML to PDF and PDF to HTML with Documentize's .NET tools—preserve layout and formatting for consistent, professional results.

PDF Security

Secure your PDFs with Documentize's .NET tools: encrypt, decrypt, and set permissions effortlessly to protect sensitive information.

PDF Optimizer

Optimize your PDFs effortlessly with Documentize's .NET tools—reduce file size, enhance performance, and maintain quality

PDF Merger

Merge PDFs easily with Documentize's .NET tools—combine multiple files into one while preserving quality and structure.

PDF Table Generator

Generate professional PDF tables with Documentize's .NET tools—customize layouts, styles, and data with ease.

PDF TOC Generator

.NET plugin designed to enhance the organization and navigation of PDF documents by dynamically generating a Table of Contents (TOC)

PDF Signature

Digitally sign PDFs with Documentize's .NET tools—ensure security, authenticity, and compliance with ease.

PDF Splitter

Split PDFs effortlessly with Documentize's .NET tools—extract pages, create new files, and manage documents with precision

PDF ChatGPT

Enhance your PDFs with AI using Documentize's ChatGPT integration—generate, edit, and analyze content intelligently.

PDF Image Extractor

Effortlessly extract images from PDF documents from within .NET applications

PDF Text Extractor

Extract text from PDFs accurately with Documentize's .NET tools—retrieve, process, and analyze content effortlessly.

PDF Timestamp Adder

Add timestamps to PDFs with Documentize's .NET tools—automatically insert date and time for enhanced document tracking.

PDF/A Converter

Convert PDFs to PDF/A format with Documentize's .NET tools—ensure long-term archiving and compliance with ease.

PDF to XLS Converter

Convert PDFs to Excel with Documentize's .NET tools—extract tables and data quickly for seamless analysis and processing.

PDF to DOC Converter

Convert PDFs to Word documents with Documentize's .NET tools—preserve formatting and structure for easy editing.

PDF to JPEG Converter

Convert PDFs to JPEG images with Documentize's .NET tools—extract high-quality images from your documents effortlessly.

PDF to PNG Converter

Convert PDFs to PNG images with Documentize's .NET tools—extract high-quality images for web and graphic use.

PDF to TIFF Converter

Convert PDFs to TIFF images with Documentize's .NET tools—extract high-resolution images for professional document management.

PDF Form Flattener

Convert interactive PDF forms into non-editable documents, making them secure from unauthorized modifications

Sep 12, 2024

Subsections of Developer's Guide

HTML Converter

The Documentize HTML Converter for .NET provides robust capabilities for converting documents between PDF and HTML formats, ideal for web applications, archiving, and report generation. With multiple options for handling resources and layouts, the converter adapts to various project requirements.

PDF to HTML Conversion

Convert PDF files to HTML to make documents accessible for web-based viewing or integration into applications where HTML format is preferred.

HTML to PDF Conversion

Transform HTML content into high-quality PDFs, perfect for generating printable reports, archiving web content, or creating shareable document formats.


Converting PDF to HTML

To convert a PDF to HTML:

  1. Configure Options: Use PdfToHtmlOptions to customize output, choosing either embedded or external resources.
  2. Define Input and Output Paths: Set the paths for your input PDF and output HTML.
  3. Execute the Conversion: Call the Process method of HtmlConverter to convert the file.

Example: Convert PDF to HTML with Embedded Resources

1// Step 1: Configure options for PDF to HTML conversion
2var options = new PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);
3
4// Step 2: Set file paths
5options.AddInput(new FileDataSource("input.pdf"));
6options.AddOutput(new FileDataSource("output.html"));
7
8// Step 3: Run the conversion
9HtmlConverter.Process(options);

Available Options for PDF to HTML Conversion

  • SaveDataType:
    • FileWithEmbeddedResources: Generates a single HTML file with all resources embedded.
    • FileWithExternalResources: Saves resources separately, ideal for large HTML files.

Converting HTML to PDF

To convert an HTML document to a PDF, follow these steps:

  1. Configure Options: Use HtmlToPdfOptions to define layout and media settings.
  2. Specify Paths: Set input HTML and output PDF file paths.
  3. Execute the Conversion: Run the Process method of HtmlConverter to convert the file.

Example: Convert HTML to PDF

1// Step 1: Configure options for HTML to PDF conversion
2var options = new HtmlToPdfOptions();
3
4// Step 2: Set file paths
5options.AddInput(new FileDataSource("input.html"));
6options.AddOutput(new FileDataSource("output.pdf"));
7
8// Step 3: Run the conversion
9HtmlConverter.Process(options);

Additional Options for HTML to PDF Conversion

  • Media Type:

    • HtmlMediaType.Print: Ideal for generating PDFs suited for printing.
    • HtmlMediaType.Screen: Use when converting content designed for digital viewing.
  • Layout Adjustments:

    • PageLayoutOption: Adjusts how HTML content fits the PDF layout, like ScaleToPageWidth to ensure the content scales to the PDF width.
    • IsRenderToSinglePage: Enables rendering the entire HTML content on a single PDF page if needed for concise presentations.

This converter is versatile for a variety of applications, from generating PDF reports based on web content to converting archives of PDF documents for web-based accessibility. For more advanced configurations, refer to the full Documentize documentation.

PDF Security

The Documentize PDF Security for .NET is a powerful tool designed to enhance the security of your PDF documents by providing encryption and decryption capabilities. It ensures that your sensitive information remains confidential and protected from unauthorized access.

How to Encrypt a PDF

To encrypt a PDF document, follow these steps:

  1. Create an instance of EncryptionOptions with the desired user and owner passwords.
  2. Add the input PDF file using the AddInput method.
  3. Add the output PDF file using AddOutput method.
  4. Execute the encryption using the Process method of Security class.
1// Create EncryptionOptions object to set instructions
2var options = new EncryptionOptions("123456", "qwerty");
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8Security.Process(options);

How to Decrypt a PDF

To decrypt a PDF document, follow these steps:

  1. Create an instance of DecryptionOptions with the necessary password.
  2. Add the input PDF file using the AddInput method.
  3. Add the output PDF file using AddOutput method.
  4. Execute the encryption using the Process method of Security class.
1// Create DecryptionOptions object to set instructions
2var options = new DecryptionOptions("123456");
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8Security.Process(options);

Key Features:

  • Encrypt PDF Documents: Secure your PDF files by adding user and owner passwords.
  • Decrypt PDF Documents: Remove encryption from PDFs when needed.
  • Automation: Integrate encryption and decryption into your .NET applications for automated workflows.
  • Compliance: Ensure your documents meet industry standards for document security.

PDF Optimizer

The Documentize PDF Optimizer is a comprehensive plugin that enhances PDF documents through advanced optimization techniques. It is designed to help reduce file sizes, rotate pages, crop content, and resize documents. These operations improve the quality and manageability of PDF files, making them easier to store, share, and view.

Optimize PDF

The following steps demonstrate how to optimize a PDF document by reducing its file size while maintaining quality.

  1. Create an OptimizeOptions object to configure optimization settings.
  2. Add input PDF file(s) and set an output location for the optimized file.
  3. Run the Process method of Optimizer to execute the optimization.
1// Create OptimizeOptions object to set instructions
2var options = new OptimizeOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8Optimizer.Process(options);

Rotate PDF

Use the RotateOptions class to adjust the orientation of pages in a PDF file.

  1. Create a RotateOptions object and configure the rotation angle.
  2. Add the input PDF file and specify the output file location.
  3. Set the rotation angle (e.g., 90 degrees) using the SetRotation method.
  4. Run the Process method of Optimizer.
 1// Create RotateOptions object to set instructions
 2var options = new RotateOptions();
 3// Set new Rotation
 4options.Rotation = Rotation.On90;
 5// Add input file path
 6options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 7// Set output file path
 8options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
 9// Perform the process
10Optimizer.Process(options);

Resize PDF

To resize a PDF document, the ResizeOptions class is used to specify the new page size for the document.

  1. Create a ResizeOptions object to define the page size.
  2. Add the input file and set the desired output location.
  3. Use the SetPageSize method to specify the new size (e.g., A4).
  4. Run the Process method of Optimizer.
 1// Create ResizeOptions object to set instructions
 2var options = new ResizeOptions();
 3// Set new PageSize
 4options.PageSize = PageSize.A3;
 5// Add input file path
 6options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 7// Set output file path
 8options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
 9// Perform the process
10Optimizer.Process(options);

Compress PDF

Compress PDF document when feasible by eliminating unused page resources, merging identical assets, and discarding redundant objects.

  1. Create an CompressOptions object to configure optimization settings.
  2. Add the input file and specify the output file location.
  3. Use the SetCropBox method to define the crop area.
  4. Run the Process method of Optimizer.
1// Create CompressOptions object to set instructions
2var options = new CompressOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8Optimizer.Process(options);

Key Features:

  • Optimization: Reduce PDF file size without losing quality.
  • Rotation: Adjust the orientation of PDF pages.
  • Resizing: Resize pages to specific dimensions (e.g., A4, Letter).
  • Compressing: Remove unused page resources and objects from the document.

PDF Merger

The Documentize PDF Merger for .NET is a versatile tool designed to merge multiple PDF documents into a single file. It simplifies the consolidation of PDF files, ensuring your documents are merged efficiently and maintaining consistency across content. The plugin handles internal resources such as fonts and images to optimize the merged document.

How to Merge PDF

To merge multiple PDF documents into a single file, follow these steps:

  1. Create an instance of MergeOptions to configure the merging process.
  2. Add input PDF files using the AddInput method.
  3. Add output PDF file using AddOutput method.
  4. Execute the merge using the Process method of Merger class.
1// Create MergeOptions object to set instructions
2var options = new MergeOptions();
3// Add input file paths
4options.AddInput(new FileDataSource("path_to_your_pdf_file_1.pdf"));
5options.AddInput(new FileDataSource("path_to_your_pdf_file_2.pdf"));
6// Set output file path
7options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
8// Perform the process
9Merger.Process(options);

Key Features:

  • Merge Multiple PDFs: Easily combine multiple PDF files into one.
  • Resource Optimization: Removes duplicate fonts and images during merging.
  • Batch Processing: Merge large batches of PDF documents in one go.

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:

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

Here’s an example:

 1var generator = new TableGenerator();
 2var options = new TableOptions();
 3
 4// Specify input and output PDF files
 5options.AddInput(new FileDataSource("input.pdf"));
 6options.AddOutput(new FileDataSource("output.pdf"));
 7
 8// Define a table with rows and cells
 9options
10    .InsertPageAfter(1) // Add table after the first page
11    .AddTable()
12        .AddRow()
13            .AddCell().AddParagraph(new TextFragment("Cell 1"))
14            .AddCell().AddParagraph(new TextFragment("Cell 2"))
15            .AddCell().AddParagraph(new TextFragment("Cell 3"));
16
17// Generate the table in the document
18generator.Process(options);

Adding Rich Content to Tables

Tables in PDF documents can include a variety of content types to enhance their functionality and appearance. Below is an example of adding HTML content to table cells:

1options
2    .AddTable()
3        .AddRow()
4            .AddCell().AddParagraph(new HtmlFragment("<h1>Header 1</h1>"))
5            .AddCell().AddParagraph(new HtmlFragment("<h2>Header 2</h2>"))
6            .AddCell().AddParagraph(new HtmlFragment("<h3>Header 3</h3>"));

Supported Content Types in Tables

The PDF Table Generator supports various content types, enabling developers to customize tables for a wide range of use cases:

  • HtmlFragment: Add HTML-based content, such as headers, lists, and formatted text.
  • TeXFragment: Include LaTeX-based content for mathematical equations and scientific notation.
  • TextFragment: Insert plain or formatted text.
  • Image: Embed images directly into table cells.

Customizing Table Layout and Structure

The plugin provides flexibility for adjusting table structure, including row height, column width, and cell alignment. These customization options allow you to design tables that match your document’s layout and styling needs.

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);

Use Cases for the PDF Table Generator

  1. Data Reporting: Present analytics, financial reports, or survey results in a clear and organized format.
  2. Form Design: Create interactive forms with structured table layouts.
  3. Document Enhancement: Improve the readability and usability of user manuals, guides, or instructional materials.
  4. Batch Processing: Automate table generation for multiple PDF documents.

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.
  • Batch Processing: Process multiple documents simultaneously for maximum efficiency.

PDF TOC Generator

The Documentize PDF TOC Generator for .NET is a powerful plugin designed to enhance the organization and navigation of PDF documents by dynamically generating a Table of Contents (TOC). This plugin simplifies the process of adding TOCs to your PDFs, making documents easier to navigate and manage.

How to Generate a TOC for a PDF

To create a Table of Contents in a PDF file, follow these steps:

  1. Create an instance of the TocGenerator class.
  2. Create an instance of TocOptions to configure TOC generation settings.
  3. Add the input PDF file using the AddInput method.
  4. Specify the output PDF file with the TOC using the AddOutput method.
  5. Call the Process method to generate the TOC.
1var tocGenerator = new TocGenerator();
2var tocOptions = new TocOptions();
3
4// Add input and output files
5tocOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
6tocOptions.AddOutput(new FileDataSource(@"C:\Samples\output_with_toc.pdf"));
7
8// Generate the TOC
9tocGenerator.Process(tocOptions);

Customizing the TOC

You can customize the Table of Contents by modifying the TocOptions class. For example, you can control the level of depth for the TOC entries, set specific formatting options, and more:

 1var tocOptions = new TocOptions
 2{
 3    Depth = 3,  // Set TOC depth level to 3
 4    FontSize = 12,  // Set font size for TOC entries
 5    Title = "Table of Contents"  // Customize the TOC title
 6};
 7
 8// Add input and output files
 9tocOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
10tocOptions.AddOutput(new FileDataSource(@"C:\Samples\output_with_toc.pdf"));
11
12// Generate the TOC with customized options
13tocGenerator.Process(tocOptions);

How to Handle Results

After processing, the Process method returns a ResultContainer object that holds details about the TOC generation. You can retrieve and print the output details:

1var resultContainer = tocGenerator.Process(tocOptions);
2
3// Access the result collection and print the output file path
4var result = resultContainer.ResultCollection[0];
5Console.WriteLine(result);

Batch Processing for Multiple PDFs

The PDF TOC Generator plugin supports batch processing, enabling you to add TOCs to multiple PDF documents simultaneously.

 1var tocGenerator = new TocGenerator();
 2var tocOptions = new TocOptions();
 3
 4// Add multiple input PDFs
 5tocOptions.AddInput(new FileDataSource(@"C:\Samples\file1.pdf"));
 6tocOptions.AddInput(new FileDataSource(@"C:\Samples\file2.pdf"));
 7
 8// Add the output PDFs with TOC
 9tocOptions.AddOutput(new FileDataSource(@"C:\Samples\output1_with_toc.pdf"));
10tocOptions.AddOutput(new FileDataSource(@"C:\Samples\output2_with_toc.pdf"));
11
12// Process the batch TOC generation
13tocGenerator.Process(tocOptions);

Key Features:

  • Dynamic TOC Generation: Create a TOC for any PDF file with automatically generated entries based on headings or bookmarks.
  • Batch Processing: Generate TOCs for multiple PDF documents at once.
  • Customization: Control the appearance and structure of the TOC, including styles, formatting, and levels of depth.
  • Efficient Workflow: Minimize time spent manually creating TOCs, especially for large or complex documents.

PDF Signature

The Documentize PDF Signature for .NET plugin allows users to digitally sign PDF documents. It offers a streamlined process for adding signatures, ensuring authenticity, and securing PDF content. The plugin supports both visible and invisible signatures and provides options to customize the signature’s position, reason, contact information, and more.

How to Sign PDF Documents

To sign a PDF document using a PFX file, follow these steps:

  1. Instantiate the SignOptions class with the PFX file path and password.
  2. Add the input PDF and the output file to the options.
  3. Run the Process method to apply the signature.
1// Create SignOptions object to set instructions
2var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8Signature.Process(options);

How to Use Stream for PFX File

You can also sign a PDF using a PFX certificate provided as a stream instead of a file path. This allows more flexible handling of certificate storage.

  1. Instantiate SignOptions with a stream containing the PFX and the password.
  2. Add the input and output files.
  3. Run the Process method to apply the signature.
1using var pfxStream = File.OpenRead(@"path_to_your_pfx_file.pfx");
2var options = new SignOptions(pfxStream, "password_of_your_pfx_file");
3options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
4options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
5// Perform the process
6Signature.Process(options);

How to Apply Invisible Signatures

To add an invisible signature (one that secures the document without displaying the signature on the document), simply set the Visible property to false.

  1. Create an instance of SignOptions.
  2. Set Visible to false.
  3. Add input and output files.
  4. Call Process to apply the invisible signature.
1var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
2options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
3options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
4// Configure invisible signature
5signOptions.Visible = false;
6// Perform the process
7Signature.Process(options);

How to use extra Options for signature of PDF Documents

You can use extra options during adding signature to a PFX file like Reason, Contact, Location, PageNumber.

  1. Instantiate the SignOptions class with the PFX file path and password.
  2. Add the input PDF and the output file to the options.
  3. Set values for your options.
  4. Run the Process method to apply the signature.
 1var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
 2options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 3options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
 4// Optional parameters
 5options.Reason = "my Reason";
 6options.Contact = "my Contact";
 7options.Location = "my Location";
 8options.PageNumber = 3;
 9// Perform the process
10Signature.Process(options);

Key Features:

  • Digitally Sign PDF Documents: Secure your documents with visible or invisible digital signatures.
  • PFX Support: Sign PDF files using a PFX certificate.
  • Customizable Options: Configure signature settings like reason, location, and contact details.
  • Visible and Invisible Signatures: Choose whether the signature is visible on the document.

PDF Splitter

The Documentize PDF Splitter for .NET is a powerful tool that simplifies the process of splitting large PDF documents into smaller, more manageable files. Whether you need to extract individual pages or divide a document into specific sections, this plugin allows you to achieve it efficiently and with minimal effort.

How to Split PDF

To split a PDF document into individual pages, follow these steps:

  1. Create an instance of SplitOptions to configure the splitting options.
  2. Add the input PDF file using the AddInput method.
  3. Add output files for each split page using the AddOutput method.
  4. Run the Process method in the Splitter class to split the document.
 1var splitOptions = new SplitOptions();
 2
 3// Add the input PDF file
 4splitOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
 5
 6// Specify output files for each page
 7splitOptions.AddOutput(new FileDataSource(@"C:\Samples\output_page_1.pdf"));
 8splitOptions.AddOutput(new FileDataSource(@"C:\Samples\output_page_2.pdf"));
 9splitOptions.AddOutput(new FileDataSource(@"C:\Samples\output_page_3.pdf"));
10
11// Process the split operation
12Splitter.Process(splitOptions);

Key Features:

  • Split PDF by Page: Break down a PDF document into individual pages.
  • Batch Processing: Split large batches of PDFs in one go.
  • Custom Split Options: Configure the splitting process based on your requirements.
  • Organized Output: Easily manage the output files for each split page or section.

PDF ChatGPT

The Documentize ChatGPT for .NET plugin is a powerful tool designed to integrate the ChatGPT API with PDF applications. This plugin allows developers to generate chat responses based on input messages and save the output in PDF format, making it suitable for creating conversational interfaces or analysis reports directly within PDF documents.

Generate Chat Responses

To generate chat responses and save them to a PDF file using the ChatGPT plugin, follow these steps:

  1. Create an instance of the PdfChatGptRequestOptions class to configure the request options.
  2. Add input and output PDF files.
  3. Set the API key and specify parameters such as maximum token count and the query for the ChatGPT model.
  4. Run the ProcessAsync method to generate the chat completion.
 1var options = new PdfChatGptRequestOptions();
 2options.ApiKey = "sk-******";  // Set your API key
 3options.MaxTokens = 1000;  // Set the maximum number of tokens
 4options.Query = "Analyze this text for key themes.";
 5
 6// Add the input PDF file
 7options.AddInput(new FileDataSource("input.pdf"));
 8
 9// Specify where to save the output PDF with chat responses
10options.AddOutput(new FileDataSource("output.pdf"));
11
12// Create an instance of the PdfChatGpt plugin
13var plugin = new PdfChatGpt();
14
15// Run the process asynchronously
16var result = await plugin.ProcessAsync(options);

Key Features:

  • Chat Completions: Generate responses using the ChatGPT API based on custom input.
  • System & User Messages: Provide both system context and user input to create dynamic conversations.
  • PDF Output: Save generated chat completions in a structured PDF file for further use.
  • Asynchronous Processing: Ensure responsive applications by processing chat completions asynchronously.

Adding System and User Messages

To create a more interactive conversation, you can add both system and user messages. These messages help shape the conversation context.

  1. Add a system message that sets the context for ChatGPT.
  2. Add a user message that represents the user’s input for the conversation.
 1var options = new PdfChatGptRequestOptions();
 2options.ApiKey = "sk-******";  // Set your API key
 3
 4// Add system message for context
 5options.AddSystemMessage("You are an AI trained to summarize text.");
 6
 7// Add user message to query the ChatGPT model
 8options.AddUserMessage("Please summarize the attached document.");
 9
10// Add input and output PDFs
11options.AddInput(new FileDataSource("input.pdf"));
12options.AddOutput(new FileDataSource("output.pdf"));
13
14// Process the request asynchronously
15var plugin = new PdfChatGpt();
16var result = await plugin.ProcessAsync(options);

PDF Image Extractor

The Documentize PDF Image Extractor for .NET plugin enables you to effortlessly extract images from PDF documents. It scans your PDF files, identifies embedded images, and extracts them while maintaining their original quality and format. This tool enhances the accessibility of visual content and streamlines the process of retrieving images from PDFs.

How to Extract Images from a PDF

To extract images from a PDF file, follow these steps:

  1. Create an instance of the ImageExtractorOptions class.
  2. Add the input file path to the options using the AddInput method.
  3. Set the output Directory path for images using the AddOutput method.
  4. Process the image extraction using the plugin.
  5. Retrieve the extracted images from the result container.
 1// Create ImageExtractorOptions to set instructions
 2var options = new ImageExtractorOptions();
 3// Add input file path
 4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 5// Set output Directory path
 6options.AddOutput(new DirectoryDataSource("path_to_results_directory"));
 7// Perform the process
 8var results = ImageExtractor.Process(options);
 9// Get path to image result
10var imageExtracted = results.ResultCollection[0].ToFile();

Extracting Images from PDF File to Streams without folder

The ImageExtractor plugin supports saving to streams, which allows you to extract images from PDF files into streams without using temporary folders.

 1// Create ImageExtractorOptions to set instructions
 2var options = new ImageExtractorOptions();
 3// Add input file path
 4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 5// Not set output - it will write results to streams
 6// Perform the process
 7var results = ImageExtractor.Process(options);
 8// Get Stream
 9var ms = results.ResultCollection[0].ToStream();
10// Copy data to file for demo
11ms.Seek(0, SeekOrigin.Begin);
12using (var fs = File.Create("test_file.png"))
13{
14    ms.CopyTo(fs);
15}

Key Features:

  • Extract Embedded Images: Identify and extract images from PDF documents.
  • Preserve Image Quality: Ensures extracted images retain their original quality.
  • Flexible Output: Save extracted images in your preferred format or location.

PDF Text Extractor

The Documentize PDF Text Extractor for .NET simplifies extracting text from PDF documents. Whether you need pure, raw, or plain text, this plugin allows you to extract text efficiently while preserving formatting or omitting it based on your needs.

How to Extract Text from PDF

To extract text from a PDF document, follow these steps:

  1. Create an instance of TextExtractorOptions to configure the extraction options.
  2. Add the input PDF file using the AddInput method.
  3. Run the Process method to extract the text.
  4. Access the extracted text using the ResultContainer.ResultCollection.
1// Create TextExtractorOptions object to set instructions
2var options = new TextExtractorOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Perform the process
6var results = TextExtractor.Process(options);
7// Get the extracted text from the ResultContainer object
8var textExtracted = results.ResultCollection[0].ToString();

Text Extraction Modes

The TextExtractor plugin offers three extraction modes, providing flexibility based on your needs.

  1. Pure Mode: Preserves the original formatting, including spaces and alignment.
  2. Raw Mode: Extracts the text without formatting, useful for raw data processing.
  3. Flatten Mode: Represent PDF content with positioning text fragments by their coordinates.
1// Create TextExtractorOptions object to set TextFormattingMode
2var options = new TextExtractorOptions(TextFormattingMode.Pure);
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Perform the process
6var results = TextExtractor.Process(options);
7// Get the extracted text from the ResultContainer object
8var textExtracted = results.ResultCollection[0].ToString();

Key Features:

  • Pure Mode: Extract text while preserving its original formatting.
  • Raw Mode: Extract text without any formatting.
  • Flatten Mode: Extract text without special characters or formatting.

PDF Timestamp Adder

The Documentize PDF Timestamp Adder for .NET is a powerful tool designed to add secure timestamps to your PDF documents. It enhances the integrity and authenticity of your documents by providing a trusted time reference, ensuring compliance with digital signature standards.

How to Add a Timestamp to PDF

To add a secure timestamp to a PDF document, follow these steps:

  1. Create an instance of the Timestamp class.
  2. Create an instance of AddTimestampOptions to configure the timestamping process.
  3. Add the input PDF file using the AddInput method.
  4. Set the output file path using AddOutput.
  5. Execute the timestamping using the Process method.
 1// Instantiate the Timestamp plugin
 2var plugin = new Timestamp();
 3
 4// Configure the timestamping options
 5var opt = new AddTimestampOptions("path_to_pfx", "password_for_pfx", "timestamp_server_url");
 6
 7// Add input PDF file
 8opt.AddInput(new FileDataSource("path_to_pdf"));
 9
10// Specify the output PDF file
11opt.AddOutput(new FileDataSource("path_to_result_pdf"));
12
13// Perform the timestamping process
14plugin.Process(opt);

How to Use Custom Authentication with Timestamp Server

You can provide basic authentication credentials when connecting to the timestamp server. This allows you to authenticate with servers that require a username and password.

  1. Create an instance of the Timestamp class.
  2. Create an instance of AddTimestampOptions, including the serverBasicAuthCredentials.
  3. Add the input file and output file paths.
  4. Call the Process method.
 1// Instantiate the Timestamp plugin
 2var plugin = new Timestamp();
 3
 4// Configure the timestamping options with authentication
 5var opt = new AddTimestampOptions("path_to_pfx", "password_for_pfx", "timestamp_server_url", "username:password");
 6
 7// Add input PDF file
 8opt.AddInput(new FileDataSource("path_to_pdf"));
 9
10// Specify the output PDF file
11opt.AddOutput(new FileDataSource("path_to_result_pdf"));
12
13// Perform the timestamping process
14plugin.Process(opt);

Handling PFX Files and Passwords

The AddTimestampOptions class allows you to use a PFX file for digital signing along with the password.

  • PFX Stream or File Path: You can provide a stream or file path to the PFX file.
  • Password Protection: Ensure you securely manage the password for the PFX file.

Key Features:

  • Add Secure Timestamps: Effortlessly add secure timestamps to your PDF documents.
  • Customizable Timestamp Servers: Use custom timestamp server URLs and authentication credentials.
  • Automation: Integrate timestamping into your .NET applications for automated workflows.
  • Compliance: Ensure your documents meet industry standards for digital signatures and timestamps.

PDF/A Converter

The Documentize PDF/A Converter for .NET is a powerful tool designed to convert PDF documents into the PDF/A format, ensuring that your content remains compliant with long-term archiving standards. This plugin also supports validating existing PDF documents for PDF/A compliance, offering both conversion and validation features in a single solution.

How to Convert PDF to PDF/A

To convert a PDF document into PDF/A format, follow these steps:

  1. Create an instance of the PdfAConverter class.
  2. Create an instance of PdfAConvertOptions to configure the conversion.
  3. Specify the desired PDF/A version (e.g., PDF/A-3B).
  4. Add the input PDF file using the AddInput method.
  5. Add the output file for the resulting PDF/A using the AddOutput method.
  6. Call the Process method to execute the conversion.
 1var pdfAConverter = new PdfAConverter();
 2var pdfAOptions = new PdfAConvertOptions
 3{
 4    PdfAVersion = PdfAStandardVersion.PDF_A_3B
 5};
 6
 7// Add the input PDF file
 8pdfAOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
 9
10// Specify the output PDF/A file
11pdfAOptions.AddOutput(new FileDataSource(@"C:\Samples\output_pdfa.pdf"));
12
13// Process the conversion
14pdfAConverter.Process(pdfAOptions);

Validating PDF/A Compliance

You can validate existing PDF files for PDF/A compliance using the PdfAValidateOptions class.

 1var pdfAConverter = new PdfAConverter();
 2var validationOptions = new PdfAValidateOptions
 3{
 4    PdfAVersion = PdfAStandardVersion.PDF_A_1A
 5};
 6
 7// Add the PDF file to be validated
 8validationOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
 9
10// Run the validation process
11var resultContainer = pdfAConverter.Process(validationOptions);
12
13// Check the validation result
14var validationResult = (PdfAValidationResult)resultContainer.ResultCollection[0].Data;
15Console.WriteLine("PDF/A Validation Passed: " + validationResult.IsValid);

Batch Processing for PDF/A Conversion

This plugin supports batch processing, allowing you to convert or validate multiple PDF files for PDF/A compliance at once.

 1var pdfAConverter = new PdfAConverter();
 2var pdfAOptions = new PdfAConvertOptions
 3{
 4    PdfAVersion = PdfAStandardVersion.PDF_A_3B
 5};
 6
 7// Add multiple input PDFs
 8pdfAOptions.AddInput(new FileDataSource(@"C:\Samples\file1.pdf"));
 9pdfAOptions.AddInput(new FileDataSource(@"C:\Samples\file2.pdf"));
10
11// Specify output files for the converted PDF/As
12pdfAOptions.AddOutput(new FileDataSource(@"C:\Samples\file1_pdfa.pdf"));
13pdfAOptions.AddOutput(new FileDataSource(@"C:\Samples\file2_pdfa.pdf"));
14
15// Process the batch conversion
16pdfAConverter.Process(pdfAOptions);

Key Features:

  • Convert to PDF/A: Seamlessly transform PDF files into the PDF/A format (such as PDF/A-1a, PDF/A-2b, PDF/A-3b) to ensure compliance with archiving standards.
  • Validate PDF/A Compliance: Check existing PDF documents for conformance with PDF/A standards and identify issues if they do not comply.
  • Batch Processing: Process multiple files at once for conversion or validation.
  • Efficient Workflow: Minimize time and effort with fast and reliable conversion processes.

PDF to XLS Converter

The Documentize PDF to XLS Converter for .NET is a versatile and powerful tool for converting PDF documents into Excel spreadsheets (XLSX/XLS/CSV/XLSM/ODS). By leveraging this plugin, developers can seamlessly transform static PDF data into dynamic and editable spreadsheets, simplifying data manipulation, analysis, and sharing.

How to Convert PDF to Excel

To convert a PDF document into an Excel file (XLSX), follow these steps:

  1. Configure the conversion settings using the PdfToXlsOptions class.
  2. Add input PDF files using the AddInput method.
  3. Specify the output file path using the AddOutput method.
  4. Execute the Process method to initiate the conversion.
1// Create PdfToXlsOptions object to set instructions
2var options = new PdfToXlsOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_file.xlsx"));
7// Perform the process
8XlsConverter.Process(options);

Customizing the PDF to Excel Conversion

The PdfToXlsOptions class allows you to customize the conversion process. For example, to convert the PDF to an XLS file and enable advanced formatting options:

 1// Create PdfToXlsOptions object to set instructions
 2var options = new PdfToXlsOptions();
 3// Add input file path
 4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 5// Specify XLS format
 6options.Format = PdfToXlsOptions.ExcelFormat.XMLSpreadSheet2003;
 7options.InsertBlankColumnAtFirst = true;
 8options.MinimizeTheNumberOfWorksheets = true;
 9// Set output file path
10options.AddOutput(new FileDataSource("path_to_result_xlsx_file.xls"));
11// Perform the process
12XlsConverter.Process(options);

Supported Output Formats

The PdfToXlsOptions.ExcelFormat enum provides a range of output formats:

  • XLSX: Office Open XML (.xlsx) File Format (default).
  • XLSM: Macro-enabled Excel format.
  • CSV: Comma-separated values.
  • ODS: Open Document Spreadsheet.
  • XMLSpreadSheet2003: Excel 2003 XML (.xls) File Format.

Key Features:

  • Flexible Conversion Options: Convert PDF files into XLSX, XLS, CSV, or other formats.
  • Content Preservation: Maintain the original structure, layout, and formatting.
  • Advanced Formatting: Insert blank columns or minimize the number of worksheets.

PDF to DOC Converter

The Documentize PDF to DOC Converter for .NET is a powerful tool designed to convert PDF documents into DOC or DOCX formats. This plugin seamlessly transforms PDF pages into editable Microsoft Word documents, making it easy to reuse, edit, and share content across multiple platforms.

How to Convert PDF to DOC/DOCX

To convert a PDF document to DOC/DOCX format, follow these steps:

  1. Create an instance of the DocConverter class.
  2. Create an instance of DocConversionOptions to configure the conversion process.
  3. Add the input PDF file using the AddInput method.
  4. Add the output file path for the resulting DOC/DOCX file using the AddOutput method.
  5. Run the Process method to execute the conversion.
 1var docConverter = new DocConverter();
 2var options = new DocConversionOptions()
 3{
 4    SaveFormat = SaveFormat.DocX,       // Output format as DOCX
 5    ConversionMode = ConversionMode.EnhancedFlow // Optimize layout and formatting
 6};
 7
 8// Add the input PDF file
 9options.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
10
11// Add the output Word document path
12options.AddOutput(new FileDataSource(@"C:\Samples\output.docx"));
13
14// Process the conversion
15docConverter.Process(options);

Converting PDF to DOC with Custom Options

The PDF to DOC Converter plugin provides several options to customize your conversion process. You can choose between different modes to control how the layout and structure of the PDF are handled during conversion.

 1var docConverter = new DocConverter();
 2var options = new DocConversionOptions()
 3{
 4    SaveFormat = SaveFormat.Doc,        // Output format as DOC
 5    ConversionMode = ConversionMode.Precise // Maintain original PDF layout as closely as possible
 6};
 7
 8// Add the input PDF file
 9options.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
10
11// Add the output Word document path
12options.AddOutput(new FileDataSource(@"C:\Samples\output.doc"));
13
14// Process the conversion
15docConverter.Process(options);

Batch Processing PDF to DOC/DOCX Conversion

The PDF to DOC Converter supports batch processing, allowing you to convert multiple PDF files at once. Here’s an example of batch conversion:

 1var docConverter = new DocConverter();
 2var options = new DocConversionOptions()
 3{
 4    SaveFormat = SaveFormat.DocX
 5};
 6
 7// Add multiple input PDF files
 8options.AddInput(new FileDataSource(@"C:\Samples\file1.pdf"));
 9options.AddInput(new FileDataSource(@"C:\Samples\file2.pdf"));
10
11// Add output file paths for the resulting DOCX files
12options.AddOutput(new FileDataSource(@"C:\Samples\output_file1.docx"));
13options.AddOutput(new FileDataSource(@"C:\Samples\output_file2.docx"));
14
15// Process the batch conversion
16docConverter.Process(options);

Key Features:

  • DOC/DOCX Conversion: Convert PDF documents to editable Microsoft Word formats (DOC or DOCX).
  • Maintain Formatting: Retain the original layout, text, and formatting during the conversion process.
  • Batch Processing: Convert multiple PDF files at once.
  • Custom Conversion Options: Fine-tune the conversion process with different modes, like Enhanced Flow, for better layout.

PDF to JPEG Converter

The Documentize PDF to JPEG Converter for .NET is a powerful tool that simplifies the conversion of PDF documents into high-quality JPEG images. This plugin is designed to make your content more accessible across platforms by transforming PDF pages into widely-used image formats.

How to Convert PDF Pages to JPEG

To convert a PDF document into JPEG images, follow these steps:

  1. Create an instance of PdfToJpegOptions to configure the conversion process.
  2. Add the input PDF File using the AddInput method.
  3. Set the output Directory path for the JPEG images using the AddOutput method.
  4. Run the Process method to convert the PDF pages into JPEG images.
1// Create PdfToJpegOptions object to set instructions
2var options = new PdfToJpegOptions();
3// Add input File path
4options.AddInput(new FileDataSource("path_to_input.pdf"));
5// Set output Directory path
6options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
7// Perform the process
8JpegConverter.Process(options);

Customizing PDF to JPEG Conversion

You can customize the conversion process by adjusting resolution, selecting page ranges, or setting image quality. Here’s how to convert the first page of a PDF at 200 DPI:

 1// Create PdfToJpegOptions object to set instructions
 2var options = new PdfToJpegOptions();
 3// Process only the first page
 4options.PageList = new List<int> { 1 };
 5// Set output resolution to 200 DPI
 6options.OutputResolution = 200;
 7// Set output quality to 50
 8options.Quality = 50;
 9// Add input File path
10options.AddInput(new FileDataSource("path_to_input.pdf"));
11// Set output Directory path
12options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
13// Perform the process
14JpegConverter.Process(options);

How to get results without a directory, or in the form of streams

The Process method returns a ResultContainer object that holds information about the conversion results. You can get streams of the converted JPEG files as shown below:

 1// Create PdfToJpegOptions object to set instructions
 2var options = new PdfToJpegOptions();
 3// Add input File path
 4options.AddInput(new FileDataSource("path_to_input.pdf"));
 5// Perform the process
 6var results = JpegConverter.Process(options);
 7// Get stream results
 8foreach (var result in results.ResultCollection)
 9{
10    var streamResultPage1 = result.ToStream();
11}

Key Features:

  • Convert PDF to JPEG: Effortlessly convert entire PDF documents or specific pages into JPEG images.
  • Custom Resolution: Adjust the resolution (e.g., 300 dpi) for high-quality outputs.
  • Page set: Select specific pages for conversion.
  • Quick Conversion: Fast and efficient process with minimal effort.

PDF to PNG Converter

The Documentize PDF to PNG Converter for .NET is an advanced tool that allows you to convert PDF documents into high-quality PNG images. This plugin is designed to make your content more versatile, accessible, and easier to share by transforming PDF pages into widely supported image formats.

How to Convert PDF to PNG

To convert a PDF document into PNG images, follow these steps:

  1. Create an instance of PdfToPngOptions to configure the conversion process.
  2. Add the input PDF File using the AddInput method.
  3. Set the output Directory path for the PNG images using the AddOutput method.
  4. Run the Process method to convert the PDF pages into PNG images.
1// Create PdfToPngOptions object to set instructions
2var options = new PdfToPngOptions();
3// Add input File path
4options.AddInput(new FileDataSource("path_to_input.pdf"));
5// Set output Directory path
6options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
7// Perform the process
8PngConverter.Process(options);

Customizing PDF to PNG Conversion

You can customize the conversion by adjusting the resolution and selecting specific pages. For example, to convert only the first page of a PDF at 200 DPI:

 1// Create PdfToPngOptions object to set instructions
 2var options = new PdfToPngOptions()
 3// Process only the first page
 4options.PageList = new List<int> { 1 };
 5// Set output resolution to 200 dpi
 6options.OutputResolution = 200;
 7// Add input File path
 8options.AddInput(new FileDataSource("path_to_input.pdf"));
 9// Set output Directory path
10options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
11// Perform the process
12PngConverter.Process(options);

Handling Conversion Results

The Process method returns a ResultContainer object that holds information about the conversion results. You can get streams of the converted PNG files as shown below:

 1// Create PdfToJpegOptions object to set instructions
 2var options = new PdfToPngOptions();
 3// Add input File path
 4options.AddInput(new FileDataSource("path_to_input.pdf"));
 5// Perform the process
 6var results = PngConverter.Process(options);
 7// Get stream results
 8foreach (var result in results.ResultCollection)
 9{
10    var streamResultPage1 = result.ToStream();
11}

Key Features:

  • Convert PDF to PNG: Quickly and efficiently convert entire PDF documents or specific pages into PNG images.
  • Customizable Resolution: Set the desired DPI (e.g., 300 DPI) for high-quality image output.
  • Page set: Select specific pages for conversion.
  • Easy Output Management: Specify output directories for each converted PNG file.
  • Quick Conversion: Fast, efficient, and requires minimal effort to configure.

PDF to TIFF Converter

The Documentize PDF to TIFF Converter for .NET is a powerful tool designed to convert PDF documents into high-quality TIFF images. This plugin ensures that your content is accessible across various platforms while maintaining excellent fidelity and versatility. You can customize the conversion process by adjusting resolution, enabling multi-page output, or selecting pages.

How to Convert PDF to TIFF

To convert a PDF document into TIFF images, follow these steps:

  1. Create an instance of PdfToTiffOptions to configure the conversion process.
  2. Add the input PDF file using the AddInput method.
  3. Specify the output file path for the TIFF images using the AddOutput method.
  4. Run the Process method to convert the PDF pages into TIFF images.
1// Create PdfToTiffOptions object to set instructions
2var options = new PdfToTiffOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output Directory path
6options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
7// Perform the process
8TiffConverter.Process(options);

Customizing Pages and DPI of PDF to TIFF Conversion

Here’s how to convert 2 pages of a PDF at 400 DPI into a TIFF file:

 1// Create PdfToTiffOptions object to set instructions
 2var options = new PdfToTiffOptions();
 3// Add input file path
 4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 5// Set output Directory path
 6options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
 7// Set Pages
 8options.PageList = [1, 3];
 9// Set result image Resolution
10options.OutputResolution = 400;
11// Perform the process
12TiffConverter.Process(options);

Multi-Page TIFF Creation

The PDF to TIFF Converter plugin supports multi-page TIFF generation, allowing you to combine multiple PDF pages into a single TIFF file for efficient archiving or printing.

 1// Create PdfToTiffOptions object to set instructions
 2var options = new PdfToTiffOptions();
 3// Add input file path
 4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 5// Set output Directory path
 6options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
 7// Enable Multi-Page TIFF output
 8options.MultiPage = true;
 9// Perform the process
10TiffConverter.Process(options);

Customizing Pages and DPI of PDF to TIFF Conversion

Here’s how to convert 2 pages of a PDF at 400 DPI into a TIFF file:

 1// Create PdfToTiffOptions object to set instructions
 2var options = new PdfToTiffOptions();
 3// Add input file path
 4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 5// Set output Directory path
 6options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
 7// Set Compression and ColorDepth
 8options.Compression = TiffCompression.RLE;
 9options.ColorDepth = TiffColorDepth.Format24bpp;
10// Perform the process
11TiffConverter.Process(options);

How to Handle Conversion Results

The Process method returns a ResultContainer object that provides details about the conversion results. You can get streams of the converted TIFF files as shown below:

 1// Create PdfToTiffOptions object to set instructions
 2var options = new PdfToTiffOptions();
 3// Add input File path
 4options.AddInput(new FileDataSource("path_to_input.pdf"));
 5// Perform the process
 6var results = TiffConverter.Process(options);
 7// Get stream results
 8foreach (var result in results.ResultCollection)
 9{
10    var streamResultPage1 = result.ToStream();
11}

Key Features:

  • Convert PDF to TIFF: Effortlessly convert entire PDF documents or specific pages into TIFF images.
  • Custom Resolution: Adjust the resolution (e.g., 300 dpi) for superior quality outputs.
  • Multi-Page TIFF: Combine multiple PDF pages into a single multi-page TIFF file.
  • Page set: Select specific pages for conversion.
  • Quick Conversion: Fast and efficient process with minimal effort.

PDF Form Flattener

The Documentize PDF Form Flattener for .NET plugin is designed to convert interactive PDF forms into non-editable documents, making them secure from unauthorized modifications. This tool transforms form fields into static content, enhancing the security of your PDF documents. It is particularly useful when you need to secure contracts, agreements, or any document where form fields must remain unchanged.

How to Flatten Form Fields in a PDF

To flatten form fields in a PDF document, follow these steps:

  1. Create an instance of the FormFlattenerOptions class.
  2. Add the input and output files to the options.
  3. Call the Process method to perform the flattening operation.
1// Create FormFlattenerOptions object to set instructions
2var options = new FormFlattenerOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8FormFlattener.Process(options);

How to Get all Fields in a PDF

You can get information how many fields contains a document.

1// Get Fields Names
2var fieldNames = FormFlattener.GetFieldNames("path_to_your_pdf_file.pdf");

How to Flatten everything except the first Field in a PDF

You can selectively flatten only specific form fields based on criteria such as the field’s position or name.

 1// Get Fields Names
 2var fieldNames = FormFlattener.GetFieldNames("path_to_your_pdf_file.pdf");
 3// Create FormFlattenerOptions object to set instructions
 4var options = new FormFlattenerOptions();
 5options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
 7// Skip 1 field.
 8options.SkipFields.Add(fieldNames[0]);
 9// Perform the process
10FormFlattener.Process(options);

Key Features:

  • Flatten All Form Fields: Converts interactive form fields into non-editable static content.
  • Flatten Selected Fields: Optionally flatten specific fields in a PDF while keeping others editable.
  • Flatten Get Fields Names: Get fields names in a PDF.
 English