---
title: "Converting PDF documents to PDF/A format | Nutrient Python SDK"
canonical_url: "https://www.nutrient.io/guides/python/conversion/pdf-to-pdf-a/"
md_url: "https://www.nutrient.io/guides/python/conversion/pdf-to-pdf-a.md"
last_updated: "2026-05-30T02:20:01.349Z"
description: "Convert PDF documents to PDF/A format using Nutrient Python SDK."
---

# Converting PDF documents to PDF/A format

PDF/A conversion addresses archival and compliance requirements for organizations that must preserve documents for extended periods. This standardized format ensures long-term accessibility and legal validity by removing dependencies on external resources and embedding all necessary components. These strict formatting requirements guarantee documents remain readable decades into the future.

The need for PDF/A compliance spans several industries:

- **Legal firms** — Managing case documents

- **Government agencies** — Preserving public records

- **Healthcare organizations** — Maintaining patient files

- **Academic institutions** — Archiving research publications

This sample demonstrates how to implement PDF-to-PDF/A conversion that meets international standards for digital preservation while maintaining document integrity.

## Streamlining document workflows with our Python SDK

Developers can implement this feature by adding a few lines of code to their applications. The SDK integrates PDF-to-PDF/A conversion directly, which removes the requirement for external tools or complex setups. Our SDK provides a reliable solution for building document archival systems or adding compliance functionality to an existing platform.

## Preparing the project

Import Nutrient Python SDK:

```python

from nutrient_sdk import Document
from nutrient_sdk import PdfConformance
from nutrient_sdk import NutrientException

```

## Loading the PDF document

This guide focuses on the `Document` class. Use Python’s [context manager](https://docs.python.org/3/reference/datamodel.html#context-managers) to enable proper lifecycle management of the document instance.

The SDK supports multiple integration methods to provide flexibility when connecting with your application. Specify the source file using a file path or a stream. This guide uses a file path as the source:

```python

def main():
    try:
        with Document.open("input.pdf") as document:

```

This path can be absolute or relative. This example loads the file from the application’s working directory.

## Converting to PDF/A format

Configure the PDF settings to target PDF/A-2b conformance level. Then export the document:

```python

            pdf_settings = document.settings.pdf_settings
            pdf_settings.conformance = PdfConformance.PDF_A_2B

            document.export_as_pdf("output.pdf")
            print("Successfully converted to PDF/A")
    except NutrientException as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    main()

```

The `set_conformance` method configures the output to meet PDF/A-2b standards. This provides enhanced features compared to PDF/A-1 while maintaining broad compatibility for archival purposes. The `export_as_pdf` method then generates a fully compliant PDF/A document.

The conversion process automatically performs these actions:

- Embeds required fonts within the document structure.

- Converts color spaces to PDF/A-compliant profiles.

- Adds required XMP metadata for archival identification.

- Validates that all external resources are properly embedded.

- Flattens interactive elements to ensure long-term accessibility.

- Optimizes the document structure for preservation stability.

## PDF/A conformance levels

The SDK supports various PDF/A conformance levels:

- **PDF/A-1a** — Highest level conformance with full accessibility and structural requirements.

- **PDF/A-1b** — Basic level conformance ensuring visual reproduction.

- **PDF/A-2a** — Enhanced version with improved compression and transparency support.

- **PDF/A-2b** — Basic level of PDF/A-2 standard (used in this sample).

- **PDF/A-3a** — Enables embedded files with full accessibility.

- **PDF/A-3b** — Enables embedded files with basic conformance.

## Error handling

Nutrient Python SDK handles errors with exception handling. The methods presented in this guide raise a `NutrientException` if a failure occurs. This helps with troubleshooting and implementing error handling logic.

## Conclusion

That’s all it takes to convert a PDF document into PDF/A format for long-term archiving. The resulting PDF/A document maintains complete visual fidelity with the original while meeting international standards for digital preservation. You can also download [this ready-to-use sample package](https://www.nutrient.io/downloads/samples/python/pdf-to-pdf-a.zip), which is configured to help you explore the Python SDK and archival conversion capabilities.
---

## Related pages

- [Converting a document from Markdown to PDF format](/guides/python/conversion/markdown-to-pdf.md)
- [Converting email files (MSG/EML) to PDF format](/guides/python/conversion/email-to-pdf.md)
- [Converting a document from XLSX to PDF format](/guides/python/conversion/excel-document-to-pdf.md)
- [Converting CAD files (DWG/DXF) to PDF format](/guides/python/conversion/cad-to-pdf.md)
- [Nutrient Python SDK conversion guides](/guides/python/conversion.md)
- [Converting PDF documents to Excel format for data analysis](/guides/python/conversion/pdf-to-excel-document.md)
- [Converting PDF documents to image format](/guides/python/conversion/pdf-to-image.md)
- [Converting PDF documents to Markdown format](/guides/python/conversion/pdf-to-markdown.md)
- [Converting PDF documents to PDF/UA format](/guides/python/conversion/pdf-to-pdf-ua.md)
- [Converting PDF documents to HTML format for web publishing](/guides/python/conversion/pdf-to-html.md)
- [Converting a document from PDF to DOCX format](/guides/python/conversion/pdf-to-word-document.md)
- [Converting PDF documents to PowerPoint presentations](/guides/python/conversion/pdf-to-powerpoint-document.md)
- [Converting a document from DOCX to PDF format](/guides/python/conversion/word-document-to-pdf.md)
- [Converting a Word document to PDF while preserving comments](/guides/python/conversion/word-document-to-pdf-including-comments.md)
- [Converting a document from PPTX to PDF format](/guides/python/conversion/powerpoint-document-to-pdf.md)
- [Converting a document from DOCX to PDF/UA format](/guides/python/conversion/word-document-to-pdf-ua.md)

