officefileapi-devexpress-dot-pdf-dot-pdfdocumentconverter-dot-convert-x28-devexpress-dot-pdf-dot-pdfcompatibility-x29.md
Converts the specified PDF document to PDF/A-1b, PDF/A-2b, and PDF/A-3b.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public void Convert(
PdfCompatibility compatibility
)
Public Sub Convert(
compatibility As PdfCompatibility
)
| Name | Type | Description |
|---|---|---|
| compatibility | PdfCompatibility |
The target format.
|
The following code snippet converts the “PdfAConversionDemo.pdf” file to PdfA2b format and displays the conversion status and issues in the console:
using DevExpress.Pdf;
// ...
// Obtain a file to convert.
var filePath = "PdfAConversionDemo.pdf";
var converter = new PdfDocumentConverter(filePath);
// Convert the file to the specified format.
converter.Convert(PdfCompatibility.PdfA2b);
converter.SaveDocument("PdfAConversionDemoResult.pdf");
// Specify and display a conversion report.
var status = converter.ConversionReport.ConversionStatus;
Console.WriteLine($"Status: {status}");
Console.WriteLine("Issues:");
var issues = converter.ConversionReport.Issues;
foreach (var issue in issues){
Console.WriteLine($"{issue.Severity}: {issue.Message}");
}
Imports DevExpress.Pdf
' ...
' Obtain a file to convert.
Private filePath = "PdfAConversionDemo.pdf"
Private converter = New PdfDocumentConverter(filePath)
' Convert the file to the specified format.
converter.Convert(PdfCompatibility.PdfA2b)
converter.SaveDocument("PdfAConversionDemoResult.pdf")
' Specify and display a conversion report.
Dim status = converter.ConversionReport.ConversionStatus
Console.WriteLine($"Status: {status}")
Console.WriteLine("Issues:")
Dim issues = converter.ConversionReport.Issues
For Each issue In issues
Console.WriteLine($"{issue.Severity}: {issue.Message}")
Next issue
The image below displays the conversion report.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Convert(PdfCompatibility) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
office-file-api-in-web-api-app/CS/Controllers/PdfController.cs#L102
// Convert the file to the specified format.
converter.Convert(format);
converter.SaveDocument(result);
See Also