PDF Converter
Convert PDF to HTML with Documentize's .NET toolsâpreserve layout and formatting for consistent, professional results.
Convert PDFs to Word documents with Documentize's .NET toolsâpreserve formatting and structure for easy editing.
Convert HTML to PDF with Documentize's .NET toolsâpreserve layout and formatting for consistent, professional results.
Convert PDFs to JPEG images with Documentize's .NET toolsâextract high-quality images from your documents effortlessly.
Convert PDFs to PDF/A format with Documentize's .NET toolsâensure long-term archiving and compliance with ease.
Convert PDFs to PNG images with Documentize's .NET toolsâextract high-quality images for web and graphic use.
Convert PDFs to TIFF images with Documentize's .NET toolsâextract high-resolution images for professional document management.
Convert PDFs to Excel with Documentize's .NET toolsâextract tables and data quickly for seamless analysis and processing.
Subsections of PDF Converter
PDF to HTML
The Documentize PDF Converter for .NET provides robust capabilities for converting documents PDF to HTML format, ideal for web applications, archiving, and report generation. With multiple options for handling resources and layouts, the converter adapts to various project requirements.
Converting PDF to HTML
Convert PDF files to HTML to make documents accessible for web-based viewing or integration into applications where HTML format is preferred.
- Configure Options: Use
PdfToHtmlOptions to customize output, choosing either embedded or external resources. - Define Input and Output Paths: Set the paths for your input PDF and output HTML.
- Execute the Conversion: Call the
Convert method of PdfConverter to convert the file.
Example: Convert PDF to HTML with Embedded Resources
1// Create PdfToHtmlOptions object to set output data type as file with embedded resources
2var options = new PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);
3// Add input file path
4options.AddInput(new FileDataSource("path_to_input.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_output.html"));
7//Perform the process
8PdfConverter.Convert(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.
PDF to DOC
The Documentize PDF 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:
- Create an instance of
PdfToDocOptions to configure the conversion process. - Add the input PDF file using the
AddInput method. - Add the output file path for the resulting file using the
AddOutput method. - Run the
Convert method to execute the conversion.
1// Create PdfToDocOptions object to set instructions
2var options = new PdfToDocOptions();
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.doc"));
7// Perform the process
8PdfConverter.Convert(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.
1// Create PdfToDocOptions object to set instructions
2var options = new PdfToDocOptions();
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.doc"));
7// Set Mode
8options.Mode = DocConversionMode.Flow;
9// Perform the process
10PdfConverter.Convert(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.
- Custom Conversion Options: Fine-tune the conversion process with different modes, like Enhanced Flow, for better layout.
HTML to PDF
The Documentize PDF Converter for .NET provides robust capabilities for converting documents between HTML to PDF format, ideal for web applications, archiving, and report generation. With multiple options for handling resources and layouts, the converter adapts to various project requirements.
Converting HTML to PDF
Transform HTML content into high-quality PDFs, perfect for generating printable reports, archiving web content, or creating shareable document formats.
To convert an HTML document to a PDF, follow these steps:
- Configure Options: Use
HtmlToPdfOptions to define layout and media settings. - Specify Paths: Set input HTML and output PDF file paths.
- Execute the Conversion: Run the
Convert method of PdfConverter to convert the file.
Example: Convert HTML to PDF
1// Create HtmlToPdfOptions
2var options = new HtmlToPdfOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_input.html"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_output.pdf"));
7//Perform the process
8PdfConverter.Convert(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 to JPEG
The Documentize PDF 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:
- Create an instance of
PdfToJpegOptions to configure the conversion process. - Add the input PDF File using the
AddInput method. - Set the output Directory path for the JPEG images using the
AddOutput method. - Run the
Convert 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
8PdfConverter.Convert(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 = [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
14PdfConverter.Convert(options);
The Convert 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 = PdfConverter.Convert(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 PDF/A
The Documentize PDF 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:
- Create an instance of
PdfToPdfAOptions to configure the conversion. - Specify the desired PDF/A version (e.g., PDF/A-3B).
- Add the input PDF file using the
AddInput method. - Add the output file for the resulting PDF/A using the
AddOutput method. - Call the
Convert method to execute the conversion.
1// Create the options class to set up the conversion process
2var options = new PdfToPdfAOptions
3{
4 PdfAVersion = PdfAStandardVersion.PDF_A_3B
5};
6
7// Add the source file
8options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf")); // replace with your actual file path
9
10// Add the path to save the converted file
11options.AddOutput(new FileDataSource("path_to_the_converted_file.pdf"));
12
13// Run the conversion
14PdfConverter.Convert(options);
Validating PDF/A Compliance
You can validate existing PDF files for PDF/A compliance using the PdfAValidateOptions class.
1// Create the options class to set up the validation process
2var options = new PdfAValidateOptions
3{
4 PdfAVersion = PdfAStandardVersion.PDF_A_1A
5};
6
7// Add one or more files to be validated
8options.AddInput(new FileDataSource("path_to_your_first_pdf_file.pdf")); // replace with your actual file path
9options.AddInput(new FileDataSource("path_to_your_second_pdf_file.pdf"));
10// add more files as needed
11
12// Run the validation and get results
13var resultContainer = PdfConverter.Validate(options);
14
15// Check the resultContainer.ResultCollection property for validation results for each file:
16for (var i = 0; i < resultContainer.ResultCollection.Count; i++)
17{
18 var result = resultContainer.ResultCollection[i];
19 var validationResult = (PdfAValidationResult) result.Data;
20 var isValid = validationResult.IsValid; // Validation result for the i-th document
21}
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.
- Efficient Workflow: Minimize time and effort with fast and reliable conversion processes.
PDF to PNG
The Documentize PDF 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:
- Create an instance of
PdfToPngOptions to configure the conversion process. - Add the input PDF File using the
AddInput method. - Set the output Directory path for the PNG images using the
AddOutput method. - Run the
Convert method to convert the PDF pages into PNG images.
1// Create PdfToPngOptions object to set instructions
2// Create PdfToPngOptions object to set instructions
3var options = new PdfToPngOptions();
4// Add input File path
5options.AddInput(new FileDataSource("path_to_input.pdf"));
6// Set output Directory path
7options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
8// Perform the process
9PdfConverter.Convert(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 = [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
12PdfConverter.Convert(options);
Handling Conversion Results
The Convert 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 = PdfConverter.Convert(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
The Documentize PDF 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:
- Create an instance of
PdfToTiffOptions to configure the conversion process. - Add the input PDF file using the
AddInput method. - Specify the output file path for the TIFF images using the
AddOutput method. - Run the
Convert 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
8PdfConverter.Convert(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
12PdfConverter.Convert(options);
Multi-Page TIFF Creation
The 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
10PdfConverter.Convert(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
11PdfConverter.Convert(options);
How to Handle Conversion Results
The Convert 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 = PdfConverter.Convert(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 to XLS
The Documentize PDF 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:
- Configure the conversion settings using the
PdfToXlsOptions class. - Add input PDF files using the
AddInput method. - Specify the output file path using the
AddOutput method. - Execute the
Convert 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_xlsx_file.xlsx"));
7// Perform the process
8PdfConverter.Convert(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
12PdfConverter.Convert(options);
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.
Subsections of PDF Extractor
The Documentize PDF 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.
To extract text from a PDF document, follow these steps:
- Create an instance of
ExtractTextOptions to configure the extraction options. - Add the input PDF file using the
AddInput method. - Run the
ExtractText method to extract the text. - Access the extracted text using the
ResultContainer.ResultCollection.
1// Create ExtractTextOptions object to set instructions
2var options = new ExtractTextOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Perform the process
6var results = PdfExtractor.ExtractText(options);
7// Get the extracted text from the ResultContainer object
8var textExtracted = results.ResultCollection[0].ToString();
The ExtractTextOptions offers three extraction modes, providing flexibility based on your needs.
- Pure Mode: Preserves the original formatting, including spaces and alignment.
- Raw Mode: Extracts the text without formatting, useful for raw data processing.
- Flatten Mode: Represent PDF content with positioning text fragments by their coordinates.
1// Create ExtractTextOptions object to set TextFormattingMode
2var options = new ExtractTextOptions(TextFormattingMode.Pure);
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Perform the process
6var results = PdfExtractor.ExtractText(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.
The Documentize PDF 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.
To extract images from a PDF file, follow these steps:
- Create an instance of the
ExtractImagesOptions class. - Add the input file path to the options using the
AddInput method. - Set the output Directory path for images using the
AddOutput method. - Process the image extraction using the plugin.
- Retrieve the extracted images from the result container.
1// Create ExtractImagesOptions to set instructions
2var options = new ExtractImagesOptions();
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 = PdfExtractor.ExtractImages(options);
9// Get path to image result
10var imageExtracted = results.ResultCollection[0].ToFile();
The PdfExtractor plugin supports saving to streams, which allows you to extract images from PDF files into streams without using temporary folders.
1// Create ExtractImagesOptions to set instructions
2var options = new ExtractImagesOptions();
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 = PdfExtractor.ExtractImages(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.
The Documentize PDF Extractor for .NET plugin provides a seamless way to extract and export data from PDF forms (AcroForms) into other formats like CSV. This dynamic tool simplifies the process of retrieving form field values, allowing for easy data management, transfer, and analysis.
To export form data from a PDF to CSV, follow these steps:
- Create an instance of the
ExtractImagesOptions class. - Define export options using the
FormExporterValuesToCsvOptions class. - Add input PDF files and specify the output CSV file.
- Run the
Process method to perform the export.
1// Create ExtractFormDataToDsvOptions object to set instructions
2var options = new ExtractFormDataToDsvOptions(',', true);
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_csv_file.csv"));
7// Perform the process
8PdfExtractor.ExtractFormData(options);
Key Features:
- Export Form Data: Extract data from PDF forms (AcroForms) into CSV or other formats.
- Data Filtering: Use predicates to filter specific form fields for export based on criteria like field type or page number.
- Flexible Output: Save exported data for analysis or transfer to spreadsheets, databases, or other document formats.
PDF Manager
Merge PDFs easily with Documentize's .NET toolsâcombine multiple files into one while preserving quality and structure.
Split PDFs effortlessly with Documentize's .NET toolsâextract pages, create new files, and manage documents with precision
Optimize your PDFs effortlessly with Documentize's .NET toolsâreduce file size, enhance performance, and maintain quality
Generate professional PDF tables with Documentize's .NET toolsâcustomize layouts, styles, and data with ease.
Enhance the organization and navigation of PDF documents by dynamically generating a Table of Contents (TOC)
Enhance your PDFs with AI using Documentize's ChatGPT integrationâgenerate, edit, and analyze content intelligently.
Subsections of PDF Manager
Merge PDF
The Documentize PDF Manager 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:
- Create an instance of
MergeOptions to configure the merging process. - Add input PDF files using the
AddInput method. - Add output PDF file using
AddOutput method. - Execute the merge using the
Merge method of PdfManager 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
9PdfManager.Merge(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.
Split PDF
The Documentize PDF Manager 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:
- Create an instance of
SplitOptions to configure the splitting options. - Add the input PDF file using the
AddInput method. - Add output files for each split page using the
AddOutput method. - Run the
Split method in the PdfManager class to split the document.
1// Create SplitOptions object to set instructions
2var options = new SplitOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file paths
6options.AddOutput(new FileDataSource("path_to_result_pdf_file_1.pdf"));
7options.AddOutput(new FileDataSource("path_to_result_pdf_file_2.pdf"));
8// Perform the process
9PdfManager.Split(options);
Key Features:
- Split PDF by Page: Break down a PDF document into individual pages.
- Custom Split Options: Configure the splitting process based on your requirements.
- Organized Output: Easily manage the output files for each split page or section.
Optimize PDF
The Documentize PDF Manager for .NET 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.
- Create an OptimizeOptions object to configure optimization settings.
- Add input PDF file(s) and set an output location for the optimized file.
- Run the
Optimize method of PdfManager 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
8PdfManager.Optimize(options);
Rotate PDF
Use the RotateOptions class to adjust the orientation of pages in a PDF file.
- Create a RotateOptions object and configure the rotation angle.
- Add the input PDF file and specify the output file location.
- Set the rotation angle (e.g., 90 degrees) using the SetRotation method.
- Run the
Rotate method of PdfManager.
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
10PdfManager.Rotate(options);
Resize PDF
To resize a PDF document, the ResizeOptions class is used to specify the new page size for the document.
- Create a ResizeOptions object to define the page size.
- Add the input file and set the desired output location.
- Use the SetPageSize method to specify the new size (e.g., A4).
- Run the
Resize method of PdfManager.
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
10PdfManager.Resize(options);
Compress PDF
Compress PDF document when feasible by eliminating unused page resources, merging identical assets, and discarding redundant objects.
- Create an CompressOptions object to configure optimization settings.
- Add the input file and specify the output file location.
- Use the SetCropBox method to define the crop area.
- Run the
Compress method of PdfManager.
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
8PdfManager.Compress(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.
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:
- 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
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.
Add TOC
The Documentize PDF Manager 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:
- Create an instance of
TocOptions to configure TOC generation settings. - Set a Title using the
Title property. - Design Headings of TOC using the
Headings.Add method. - Add the input PDF file using the
AddInput method. - Specify the output PDF file with the TOC using the
AddOutput method. - Call the
AddTableOfContents method to generate the TOC.
1// Create TocOptions object to set instructions
2var options = new TocOptions();
3// Set the Title
4options.Title = "My Table of Contents";
5// Design Headings
6options.Headings.Add(new TocHeading("Introduction", 2));
7options.Headings.Add(new TocHeading("Chapter I", 3));
8options.Headings.Add(new TocHeading("Chapter II", 4));
9options.Headings.Add(new TocHeading("Chapter III", 5));
10// Add input file path
11options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
12// Set output file path
13options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
14// Perform the process
15PdfManager.AddTableOfContents(options);
Generate bookmarks in a TOC for a PDF
You can use ‘GenerateBookmarks’ property for bookmarks generation.
1// Create TocOptions object to set instructions
2var options = new TocOptions();
3// Set the Title
4options.Title = "My Table of Contents";
5// Generate links in bookmarks
6options.GenerateBookmarks = true;
7// Design Headings
8options.Headings.Add(new TocHeading("Introduction", 2, false, 1));
9options.Headings.Add(new TocHeading("Chapter I", 3, true, 1));
10options.Headings.Add(new TocHeading("Chapter II", 4, true, 1));
11options.Headings.Add(new TocHeading("Example A", 4, true, 2));
12options.Headings.Add(new TocHeading("Example B", 4, true, 2));
13options.Headings.Add(new TocHeading("Example C", 4, true, 2));
14options.Headings.Add(new TocHeading("Example D", 4, true, 2));
15options.Headings.Add(new TocHeading("Chapter III", 5, true, 1));
16// Add input file path
17options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
18// Set output file path
19options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
20// Perform the process
21PdfManager.AddTableOfContents(options);
How to get Result as Stream
1// Create TocOptions object to set instructions
2var options = new TocOptions();
3// Set the Title
4options.Title = "My Table of Contents";
5// Design Headings
6options.Headings.Add(new TocHeading("Introduction", 2, false, 1));
7// Add input file path
8options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
9// Set output stream
10var outputStream = new MemoryStream();
11options.AddOutput(new StreamDataSource(outputStream));
12options.CloseOutputStreams = false;
13// Perform the process
14PdfManager.AddTableOfContents(options);
Customizing the TOC Heading
You can customize the Table of Contents Heading by modifying the TocHeading class. For example, you can use ‘GenerateNumbering’ or done it manually.
Property ‘PageNumber’ used for links on pages. Also you can use Level property.
1var heading = new TocHeading();
2heading.Text = "Intro";
3heading.PageNumber = 5;
4heading.GenerateNumbering = true;
5heading.Level = 2;
6
7var tocOptions = new TocOptions();
8options.Headings.Add(heading);
9// Add input and output files
10tocOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
11tocOptions.AddOutput(new FileDataSource(@"C:\Samples\output_with_toc.pdf"));
12
13// Generate the TOC with customized options
14PdfManager.AddTableOfContents(tocOptions);
Key Features:
- Dynamic TOC Generation: Create a TOC for any PDF file with automatically generated entries based on headings or bookmarks.
- 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.
Use ChatGPT
The Documentize PDF Manager 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:
- Create an instance of the
ChatGptRequestOptions class to configure the request options. - Add input and output PDF files.
- Set the API key and specify parameters such as maximum token count and the query for the ChatGPT model.
- Run the
CreatePdfByChatGptRequestAsync method to generate the chat completion.
1var options = new ChatGptRequestOptions();
2// Set output file path
3options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
4options.ApiKey = "Your API key."; // You need to provide the key to access the API.
5options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
6
7// Add the request messages.
8options.Messages.Add(new Message
9{
10 Content = "You are a helpful assistant.",
11 Role = Role.System
12});
13options.Messages.Add(new Message
14{
15 Content = "What is the biggest pizza diameter ever made?",
16 Role = Role.User
17});
18
19// Process the request.
20var result = await PdfManager.CreatePdfByChatGptRequestAsync(options);
21
22var fileResultPath = result.ResultCollection[0].Data;
23var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
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.
- Add a system message that sets the context for ChatGPT.
- Add a user message that represents the userâs input for the conversation.
1var options = new ChatGptRequestOptions();
2// Set output file path
3options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
4
5// Add the PDF text source.
6// In case of multiple sources, the text from each document will be added to the request message collection
7// as a separate message with the role "user".
8options.AddInput(new FileDataSource("TextSource.pdf"));
9
10options.ApiKey = "Your API key."; // You need to provide the key to access the API.
11options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
12
13// Add the request message.
14// In this case, the system message with Content = "You are a helpful assistant." is added by default.
15// The role of the query message is "user" by default.
16options.Query = "How many letters in the provided text?";
17
18// Process the request.
19var result = await PdfManager.CreatePdfByChatGptRequestAsync(options);
20
21var fileResultPath = result.ResultCollection[0].Data;
22var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
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.
Subsections of PDF Security
Encrypt
The Documentize PDF Security for .NET is a powerful tool designed to enhance the security of your PDF documents by providing encryption, decryption and signing 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:
- Create an instance of
EncryptOptions with the desired user and owner passwords. - Add the input PDF file using the
AddInput method. - Add the output PDF file using
AddOutput method. - Execute the encryption using the
Encrypt method of PdfSecurity class.
1// Create EncryptOptions object to set instructions
2var options = new EncryptOptions("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
8PdfSecurity.Encrypt(options);
Key Features:
- Encrypt PDF Documents: Secure your PDF files by adding user and owner passwords.
- Automation: Integrate encryption and decryption into your .NET applications for automated workflows.
- Compliance: Ensure your documents meet industry standards for document security.
Decrypt
The Documentize PDF Security for .NET is a powerful tool designed to enhance the security of your PDF documents by providing encryption, decryption and signing capabilities. It ensures that your sensitive information remains confidential and protected from unauthorized access.
How to Decrypt a PDF
To decrypt a PDF document, follow these steps:
- Create an instance of
DecryptionOptions with the necessary password. - Add the input PDF file using the
AddInput method. - Add the output PDF file using
AddOutput method. - Execute the encryption using the
Decrypt method of PdfSecurity class.
1// Create DecryptOptions object to set instructions
2var options = new DecryptOptions("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
8PdfSecurity.Decrypt(options);
Key Features:
- 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.
Sign
The Documentize PDF Security 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:
- Instantiate the
SignOptions class with the PFX file path and password. - Add the input PDF and the output file to the options.
- Run the
Sign 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
8PdfSecurity.Sign(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.
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
6PdfSecurity.Sign(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.
- Create an instance of
SignOptions. - Set
Visible to false. - Add input and output files.
- Call
Sign 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
7PdfSecurity.Sign(options);
You can use extra options during adding signature to a PFX file like Reason, Contact, Location, PageNumber.
- Instantiate the
SignOptions class with the PFX file path and password. - Add the input PDF and the output file to the options.
- Set values for your options.
- Run the
Sign 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// Optional parameters
8options.Reason = "my Reason";
9options.Contact = "my Contact";
10options.Location = "my Location";
11options.PageNumber = 3;
12// Perform the process
13PdfSecurity.Sign(options);
How to Add a Timestamp to PDF
To add a secure timestamp to a PDF document, follow these steps:
- Create an instance of
AddTimestampOptions to configure the timestamping process. - Add the input PDF file using the
AddInput method. - Set the output file path using
AddOutput. - Execute the timestamping using the
Sign method.
1// Create SignOptions object to set instructions
2var options = new SignOptions("path_to_your_pfx_file.pfx", "password_for_your_pfx_file");
3options.TimestampOptions = new TimestampOptions("server_url");
4// Add input file path
5options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
6// Set output file path
7options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
8// Perform the process
9PdfSecurity.Sign(options);
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// Configure the timestamping options with authentication
2options.TimestampOptions = new TimestampOptions("timestamp_server_url", "username:password");
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.
- Customizable Timestamp Servers: Use custom timestamp server URLs and authentication credentials.