Class PdfConverter

Information

Représente le composant Documentize.PdfConverter. Utilisé pour convertir des documents PDF vers d’autres formats comme DOCX/DOC, XLSX/XLS/CSV/XLSM/ODS, HTML, JPEG, PNG, TIFF, PDF/A. Permet également d’effectuer une validation PDF/A et de convertir du HTML en PDF.

Représente le composant Documentize.PdfConverter. Utilisé pour convertir des documents PDF vers d’autres formats comme DOCX/DOC, XLSX/XLS/CSV/XLSM/ODS, HTML, JPEG, PNG, TIFF, PDF/A. Permet également d’effectuer une validation PDF/A et de convertir du HTML en PDF.

public static class PdfConverter

Inheritance

objectPdfConverter

Inherited Members

Methods

Convert(PdfToDocOptions)

Convertit un document PDF en formats DOC/DOCX.

public static ResultContainer Convert(PdfToDocOptions options)

Parameters

  • options PdfToDocOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir un document PDF au format Doc.

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

L’exemple montre comment convertir un document PDF au format Doc en définissant le Mode.

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

Exceptions

ArgumentException

Si les options ne sont pas définies.

Convert(PdfToXlsOptions)

Convertit un document PDF en formats XLSX/XLS/CSV/XLSM/ODS.

public static ResultContainer Convert(PdfToXlsOptions options)

Parameters

  • options PdfToXlsOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir un PDF en document XLSX.

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

L’exemple montre comment convertir un PDF en document XLS.

// Create PdfToXlsOptions object to set instructions
var options = new PdfToXlsOptions();
// Add input file path
options.AddInput(new FileData("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 FileData("path_to_result_xlsx_file.xls"));
// Perform the process
PdfConverter.Convert(options);

Exceptions

ArgumentException

Si les options ne sont pas définies.

Convert(PdfToHtmlOptions)

Convertit un document PDF en format HTML.

public static ResultContainer Convert(PdfToHtmlOptions options)

Parameters

  • options PdfToHtmlOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir un PDF en document HTML.

// 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 FileData("path_to_input.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_output.html"));
//Perform the process
PdfConverter.Convert(options);

Exceptions

ArgumentException

Si les options ne sont pas définies.

Convert(HtmlToPdfOptions)

Convertit un document HTML en format PDF.

public static ResultContainer Convert(HtmlToPdfOptions options)

Parameters

  • options HtmlToPdfOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir un document HTML en PDF.

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

Exceptions

ArgumentException

Si les options ne sont pas définies.

Convert(PdfToJpegOptions)

Convertit un document PDF en format JPEG.

public static ResultContainer Convert(PdfToJpegOptions options)

Parameters

  • options PdfToJpegOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir un document PDF en format JPEG.

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

L’exemple montre comment convertir un document PDF en JPEG avec paramètres pour les pages, la résolution, la qualité.

// 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 FileData("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryData("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

L’exemple montre comment convertir un document PDF en JPEG vers des flux.

// Create PdfToJpegOptions object to set instructions
var options = new PdfToJpegOptions();
// Add input File path
options.AddInput(new FileData("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();
}

Exceptions

ArgumentException

Si les options ne sont pas définies.

Convert(PdfToPngOptions)

Convertit un document PDF en format PNG.

public static ResultContainer Convert(PdfToPngOptions options)

Parameters

  • options PdfToPngOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir un document PDF en format PNG.

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

L’exemple montre comment convertir une page du PDF en format PNG.

// 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 FileData("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryData("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

L’exemple montre comment convertir un document PDF en PNG vers des flux.

// Create PdfToJpegOptions object to set instructions
var options = new PdfToPngOptions();
// Add input File path
options.AddInput(new FileData("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();
}

Exceptions

ArgumentException

Si les options ne sont pas définies.

Convert(PdfToTiffOptions)

Convertit un document PDF en format TIFF.

public static ResultContainer Convert(PdfToTiffOptions options)

Parameters

  • options PdfToTiffOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir un document PDF en format TIFF.

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

L’exemple montre comment convertir un PDF en TIFF en personnalisant les pages et le DPI.

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

L’exemple montre comment convertir un PDF en TIFF multi‑pages.

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

L’exemple montre comment convertir un PDF en TIFF en personnalisant la compression et la profondeur de couleur.

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

L’exemple montre comment convertir un document PDF en TIFF vers des flux.

// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input File path
options.AddInput(new FileData("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();
}

Exceptions

ArgumentException

Si les options ne sont pas définies.

Convert(PdfToPdfAOptions)

Convertit un document PDF en format PDF/A.

public static ResultContainer Convert(PdfToPdfAOptions options)

Parameters

  • options PdfToPdfAOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment convertir le document PDF en format PDF/A (PDF/A‑3b dans cet exemple) :

// 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 FileData("path_to_your_pdf_file.pdf")); // replace with your actual file path

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

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

Exceptions

ArgumentException

Si les options ne sont pas définies.

Validate(PdfAValidateOptions)

Vérifie la conformité d’un document PDF au format PDF/A spécifié.

public static ResultContainer Validate(PdfAValidateOptions options)

Parameters

  • options PdfAValidateOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment valider la conformité d’un PDF au format PDF/A (PDF/A‑1a dans cet exemple) :

// 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 FileData("path_to_your_first_pdf_file.pdf")); // replace with your actual file path
options.AddInput(new FileData("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:
foreach (var result in resultContainer.ResultCollection)
{
    var validationResult = (PdfAValidationResult) result.Data;
    var isValid = validationResult.IsValid; // Validation result for document
}

Exceptions

ArgumentException

Si les options ne sont pas définies.

Namespace: Documentize Assembly: Documentize.dll

 Français