Convert PDFs and images to PDF/A in MAUI
Nutrient MAUI SDK enables you to convert PDFs, Office documents, and images to PDF/A client-side. For more information on the supported source file formats, see the list of supported file types.
Nutrient MAUI SDK supports converting source files into all PDF/A versions and conformance levels:
-
PDF/A-1a, PDF/A-1b
-
PDF/A-2a, PDF/A-2u, PDF/A-2b
-
PDF/A-3a, PDF/A-3u, PDF/A-3b
-
PDF/A-4, PDF/A-4e, PDF/A-4f
For more information on the long-term preservation of documents, check out our demo video below, or have a look at our complete guide to PDF/A.
Converting documents to PDF/A
To convert a PDF, an Office file, or an image to PDF/A, follow these steps:
-
Use the
ExportDocumentAsync
method to convert the source file to PDF/A. This method takes an object as its parameter, which configures the conversion. For conversion to PDF/A, set thePDFAConformance
property of the configuration object that you pass to theExportDocumentAsync
method to one of the values of thePDFAConformance
enum. -
Save the output document. The
ExportDocumentAsync
method returns aTask
that resolves to abyte[]
that contains the output PDF/A document. You can use the resultingbyte[]
to save or persist the output PDF/A in storage. For more information on downloading or persisting the exportedbyte[]
, see the guides on saving a document.
The example below loads a PDF document and exports it to a PDF with conformance level PDF/A-4f:
var documentFromLocalStorage = await PSPDFKitController.LoadDocument(docxFilePath, PSPDFKitController.CreateViewerConfiguration()); var exportConfiguration = documentFromLocalStorage.CreateExportConfiguration(); exportConfiguration.PDFAConformance = PDFAConformance.PDFA_4F; var exportedDocumentAsPDF = await documentFromLocalStorage.ExportDocumentAsync(exportConfiguration);
For more control over exporting documents, use IExportConfiguration
. If you pass null
instead, the default configuration will be used:
var exportOptions = _document.CreateExportConfiguration(); { ExcludeAnnotations = true, ExportForPrinting = true, ExportIncrementally = false, Flatten = true, }; var exportedDocumentContent = await _document.ExportDocumentAsync(exportConfiguration);