This module uses the DevExpress PDF Document API (the PdfDocumentConverter class) to convert PDF files to PDF/A format. You can process the sample file or supply your own document. To do the latter, select Upload a File from the file selection drop-down menu.
Use the Convert to... dropdown button to select the compatibility level (PDF/A-1b, PDF/A-2b, or PDF/A-3b), convert the document, and download the result.
Select a Document
Sample_Main.pdf
using DevExpress.Pdf;
IReadOnlyList<Stream> ConvertToCompatible(Stream documentStream, PdfCompatibility compatibilityLevel) {
using var converter = new PdfDocumentConverter(documentStream);
var outputStream = new MemoryStream();
var reportStream = new MemoryStream();
var streamWriter = new StreamWriter(reportStream);
converter.Convert(compatibilityLevel);
converter.SaveDocument(outputStream);
streamWriter.WriteLine($"Conversion Status : {converter.ConversionReport.ConversionStatus}");
if(converter.ConversionReport.Issues.Any()) {
streamWriter.WriteLine("Found Issues :");
streamWriter.Write(string.Join("\r\n", converter.ConversionReport.Issues.Select(x => $"{x.Severity} : {x.Message}")));
}
streamWriter.Flush();
reportStream.Position = 0;
outputStream.Position = 0;
return new List<Stream> { outputStream, reportStream };
}