This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/conversion/to-pdfa.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. PDF to PDF/A in JavaScript: All standards | Nutrient

Nutrient Web SDK enables you to convert PDFs, Office documents, and images to PDF/A client-side, without the need for server-side processing. For more information on the supported source file formats, see the list of supported file types.

Nutrient Web 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

When exporting app-provided documents to PDF/A with DWS Viewer API authorization, use Nutrient Web SDK 1.24.0 or later. For loading configuration, refer to the DWS Viewer API guide.

To convert a PDF, an Office file, or an image to PDF/A, follow the steps below.

  1. Load the source file.
  2. Use the exportPDF 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, add an outputFormat key to the configuration object that you pass to the exportPDF method. The value of this key is an object. Within this object, the value of the conformance key is a member of the Conformance enumeration that specifies the conformance level of the output PDF document. If you set this value to true, the output is a document with conformance level PDF/A-2b.
  3. Save the output document. The exportPDF method returns a Promise that resolves to an ArrayBuffer that contains the output PDF/A document. You can use the resulting ArrayBuffer to download or persist the output PDF/A in storage. For more information on downloading or persisting the exported ArrayBuffer, 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:

NutrientViewer.load({
container: "#pspdfkit",
document: "source.pdf",
licenseKey: "YOUR_LICENSE_KEY"
}).then((instance) => {
instance.exportPDF({
outputFormat: {
conformance: NutrientViewer.Conformance.PDFA_4F
}
});
});

The example below loads a PDF document in headless mode, exports it to a PDF/A document with conformance level PDF/A-2b, and downloads it in the client’s browser:

NutrientViewer.load({
container: "#pspdfkit",
document: "source.pdf",
licenseKey: "YOUR_LICENSE_KEY",
headless: true
})
.then((instance) =>
instance.exportPDF({
outputFormat: true
})
)
.then(function (buffer) {
const blob = new Blob([buffer], { type: "application/pdf" });
const objectUrl = window.URL.createObjectURL(blob);
downloadPdf(objectUrl);
window.URL.revokeObjectURL(objectUrl);
});
function downloadPdf(blob) {
const a = document.createElement("a");
a.href = blob;
a.style.display = "none";
a.download = "output.pdf";
a.setAttribute("download", "output.pdf");
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}

When you export a document, you can choose how Nutrient Web SDK writes the output. For more information, refer to the flattening annotations guide and the incremental saving guide.

Use autosave to configure when Nutrient Web SDK saves changes. For more information, refer to the autosave guide.

Call instance.save() before exporting if autosave is disabled, or after an undo, redo, or paste. Otherwise, the exported file doesn’t include unsaved annotations.