Class PdfConverter

Информация

Represents Documentize.PdfConverter plugin. Used to Convert PDF documents to another formats like DOCX/DOC, XLSX/XLS/CSV/XLSM/ODS, HTML, JPEG, PNG, TIFF, PDF/A. Also allows you to perform PDF/A Validation and Convert HTML to PDF.

Represents Documentize.PdfConverter plugin. Used to Convert PDF documents to another formats like DOCX/DOC, XLSX/XLS/CSV/XLSM/ODS, HTML, JPEG, PNG, TIFF, PDF/A. Also allows you to perform PDF/A Validation and Convert HTML to PDF.

public static class PdfConverter

Inheritance

objectPdfConverter

Inherited Members

Examples

The example demonstrates how to convert PDF document to Doc format.

// Create PdfToDocOptions object to set instructions
var options = new PdfToDocOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_file.doc"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document to Doc format with setting Mode.

// Create PdfToDocOptions object to set instructions
var options = new PdfToDocOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_file.doc"));
// Set Mode
options.Mode = DocConversionMode.Flow;
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF to XLSX document.

// Create PdfToXlsOptions object to set instructions
var options = new PdfToXlsOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_xlsx_file.xlsx"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF to XLS document.

// Create PdfToXlsOptions object to set instructions
var options = new PdfToXlsOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Specify XLS format
options.Format = PdfToXlsOptions.ExcelFormat.XMLSpreadSheet2003;
options.InsertBlankColumnAtFirst = true;
options.MinimizeTheNumberOfWorksheets = true;
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_xlsx_file.xls"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF to HTML document.

// Create PdfToHtmlOptions object to set output data type as file with embedded resources
var options = new PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);
// Add input file path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.html"));
//Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert HTML to PDF document.

// Create HtmlToPdfOptions
var options = new HtmlToPdfOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_input.html"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.pdf"));
//Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into JPEG format.

// Create PdfToJpegOptions object to set instructions
var options = new PdfToJpegOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into JPEG format with settings for pages, resolution, quality.

// Create PdfToJpegOptions object to set instructions
var options = new PdfToJpegOptions();
// Process only the first page
options.PageList = [1];
// Set output resolution to 200 DPI
options.OutputResolution = 200;
// Set output quality to 50
options.Quality = 50;
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into JPEG format to streams.

// Create PdfToJpegOptions object to set instructions
var options = new PdfToJpegOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Perform the process
var results = PdfConverter.Convert(options);
// Get stream results
foreach (var result in results.ResultCollection)
{
    var streamResultPage1 = result.ToStream();
}

The example demonstrates how to convert PDF document into PNG format.

// Create PdfToPngOptions object to set instructions
var options = new PdfToPngOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert 1 page of PDF document into PNG format.

// Create PdfToPngOptions object to set instructions
var options = new PdfToPngOptions()
// Process only the first page
options.PageList = [1];
// Set output resolution to 200 DPI
options.OutputResolution = 200;
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into PNG format to streams.

// Create PdfToJpegOptions object to set instructions
var options = new PdfToPngOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Perform the process
var results = PdfConverter.Convert(options);
// Get stream results
foreach (var result in results.ResultCollection)
{
    var streamResultPage1 = result.ToStream();
}

The example demonstrates how to convert PDF document into TIFF format.

// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into TIFF format with Customizing Pages and DPI.

// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Set Pages
options.PageList = [1, 3];
// Set result image Resolution
options.OutputResolution = 400;
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into TIFF as Multi-Page.

// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Enable Multi-Page TIFF output
options.MultiPage = true;
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into TIFF format with Customizing Compression and ColorDepth.

// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Set Compression and ColorDepth
options.Compression = TiffCompression.RLE;
options.ColorDepth = TiffColorDepth.Format24bpp;
// Perform the process
PdfConverter.Convert(options);

The example demonstrates how to convert PDF document into TIFF format to streams.

// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Perform the process
var results = PdfConverter.Convert(options);
// Get stream results
foreach (var result in results.ResultCollection)
{
    var streamResultPage1 = result.ToStream();
}

The example demonstrates how to convert the PDF document in a PDF/A format (PDF/A-3b in this case):

// Create the options class to set up the conversion process
var options = new PdfToPdfAOptions
{
    PdfAVersion = PdfAStandardVersion.PDF_A_3B
};

// Add the source file
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf")); // replace with your actual file path

// Add the path to save the converted file
options.AddOutput(new FileDataSource("path_to_the_converted_file.pdf"));

// Run the conversion
PdfConverter.Convert(options);

The example demonstrates how to validate the PDF document conformance to PDF/A format (PDF/A-1a in this case):

// Create the options class to set up the validation process
var options = new PdfAValidateOptions
{
    PdfAVersion = PdfAStandardVersion.PDF_A_1A
};

// Add one or more files to be validated
options.AddInput(new FileDataSource("path_to_your_first_pdf_file.pdf")); // replace with your actual file path
options.AddInput(new FileDataSource("path_to_your_second_pdf_file.pdf"));
// add more files as needed

// Run the validation and get results
var resultContainer = PdfConverter.Validate(options);

// Check the resultContainer.ResultCollection property for validation results for each file:
for (var i = 0; i < resultContainer.ResultCollection.Count; i++)
{
    var result = resultContainer.ResultCollection[i];
    var validationResult = (PdfAValidationResult) result.Data;
    var isValid = validationResult.IsValid; // Validation result for the i-th document
}

Methods

Convert(PdfToDocOptions)

Converts PDF document into DOC/DOCX formats.

public static ResultContainer Convert(PdfToDocOptions options)

Parameters

  • options PdfToDocOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Convert(PdfToXlsOptions)

Converts PDF document into XLSX/XLS/CSV/XLSM/ODS formats.

public static ResultContainer Convert(PdfToXlsOptions options)

Parameters

  • options PdfToXlsOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Convert(PdfToHtmlOptions)

Converts PDF document into HTML format.

public static ResultContainer Convert(PdfToHtmlOptions options)

Parameters

  • options PdfToHtmlOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Convert(HtmlToPdfOptions)

Converts HTML document into PDF format.

public static ResultContainer Convert(HtmlToPdfOptions options)

Parameters

  • options HtmlToPdfOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Convert(PdfToJpegOptions)

Converts PDF document into JPEG format.

public static ResultContainer Convert(PdfToJpegOptions options)

Parameters

  • options PdfToJpegOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Convert(PdfToPngOptions)

Converts PDF document into PNG format.

public static ResultContainer Convert(PdfToPngOptions options)

Parameters

  • options PdfToPngOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Convert(PdfToTiffOptions)

Converts PDF document into TIFF format.

public static ResultContainer Convert(PdfToTiffOptions options)

Parameters

  • options PdfToTiffOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Convert(PdfToPdfAOptions)

Converts PDF document into PDF/A format.

public static ResultContainer Convert(PdfToPdfAOptions options)

Parameters

  • options PdfToPdfAOptions: An options object containing instructions for the operation.

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Validate(PdfAValidateOptions)

Check PDF document for compliance with specified format PDF/A.

public static ResultContainer Validate(PdfAValidateOptions options)

Parameters

Returns

ResultContainer : An object containing the result of the operation.

Exceptions

ArgumentException

If options not set.

Namespace: Documentize Assembly: Documentize.dll

17 нояб. 2025 г.
 Русский