> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/pdf-a/convert.md).

# Convert PDF to PDF/A on Server/Desktop

Convert PDF to PDF/A with ease using our tool. Supports all PDF/A versions and conformance levels. Validate existing PDFs for compliance and convert generic PDFs to PDF/A format. Get detailed reports

{% hint style="info" %}
**Requirements**

*These packages are required to use these features in production. Trial keys have unlimited access to all features*

<a href="https://apryse.com/capabilities#Archive" class="button primary">Package: Archive</a><a href="https://showcase.apryse.com/pdfa-conversion" class="button primary">Live demo</a>
{% endhint %}

Convert a PDF document to PDF/A format. Supports all PDF/A versions and conformance levels: PDF/A-1A, PDF/A-1B, PDF/A-2A, PDF/A-2B, PDF/A-2U, PDF/A-3A, PDF/A-3B, PDF/A-3U, PDF/A-4, PDF/A-4E, PDF/A-4F.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
PDFACompliance pdf_a = new PDFACompliance(true, filename, null, PDFACompliance.Conformance.e_Level2B, null, 10, false);
pdf_a.SaveAs(output_filename, false);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFACompliance pdf_a(false, filename, 0, PDFACompliance::e_Level2B, 0, 10);
pdf_a.SaveAs(output_filename);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
pdfa := NewPDFACompliance(false, filename, "", PDFAComplianceE_Level2B, nil, 0, 10, false)
pdfa.SaveAs(output_filename, false)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFACompliance pdf_a = new PDFACompliance(true, filename, null, PDFACompliance.e_Level2B, null, 10);
pdf_a.saveAs(output_filename, false);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  const pdfa = await PDFNet.PDFACompliance.createFromUrl(true, filename, '', PDFNet.PDFACompliance.Conformance.e_Level2B, undefined, 10);
  const buf = await pdfa.saveAsFromBuffer(false);

  //optionally save the blob to a file or upload to a server
  const blob = new Blob([buf], { type: 'application/pdf' });
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
pdf_a = PDFACompliance(true, filename, null, PDFACompliance.e_Level2B, null, 10)
pdf_a.saveAs(output_filename, false)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTPDFACompliance *pdf_a = [[PTPDFACompliance alloc] initWithConvert:YES file_path:filename password:@"" conf:e_ptLevel2B exceptions:0 num_exceptions:10 max_ref_objs:10 first_stop:NO];
[pdf_a SaveAsFile:output_filename linearized: NO];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let pdf_a: PTPDFACompliance = PTPDFACompliance(convert:true, file_path:filename, password:"", conf:e_ptLevel2B, exceptions:0, num_exceptions: 10, max_ref_objs:10, first_stop:false)
pdf_a.save(asFile:output_filename, linearized: false)
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$pdf_a = new PDFACompliance(true, $filename, "0", PDFACompliance::e_Level2B, 0, 10);
$pdf_a->SaveAs($output_filename, false);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
pdf_a = PDFACompliance(True, filename, None, PDFACompliance.e_Level2B, 0, 10)
pdf_a.SaveAs(output_filename, False)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
pdf_a = PDFACompliance.new(true, filename, nil, PDFACompliance::E_Level2B, 0, 10)
pdf_a.SaveAs(output_filename, false)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim pdf_a As PDFACompliance = New PDFACompliance(True, filename, Nothing, PDFACompliance.Conformance.e_Level2B, Nothing, 10, False)
pdf_a.SaveAs(output_filename, False)
```

{% endcode %}
{% endtab %}
{% endtabs %}

[Convert PDF to PDF/A](/core/get-started/samples/pdfatest.md) Full sample code which illustrates how to validate existing PDF documents for PDF/A compliance as well as to convert generic PDF documents to PDF/A format. Code sample is available in C++, C#, Java, Python, Go, PHP, Ruby & VB.

## About PDF/A

PDFACompliance class is used to validate PDF documents for PDF/A (ISO 19005:1/2/3/4) compliance or to convert existing PDF files to PDF/A compliant documents.

The conversion option analyzes the content of existing PDF files and performs a sequence of modifications in order to produce a PDF/A compliant document. Features that are not suitable for long-term archiving (such as encryption, obsolete compression schemes, missing fonts, or device-dependent color) are replaced with their PDF/A compliant equivalents. Because the conversion process applies only necessary changes to the source file, the information loss is minimal. Also, because the converter provides a detailed report for each change, it is simple to inspect changes and to determine whether the conversion loss is acceptable.

The validation option can be used to quickly determine whether a PDF file fully complies with the PDF/A specification according to the international standard ISO 19005:1/2/3/4. For files that are not compliant, the validation option can be used to produce a detailed report of compliance violations as well as a list of relevant error objects.

Key Functions:

* Checks if a PDF file is compliant with any PDF/A specifications (ISO 19005-1, 19005-2, 19005-3, 19005-4).
* Converts any PDF to a PDF/A compliant document.
* Supports all PDFA versions and conformance levels: PDF/A-1A, PDF/A-1B, PDF/A-2A, PDF/A-2B, PDF/A-2U, PDF/A-3A, PDF/A-3B, PDF/A-3U, PDF/A-4, PDF/A-4E, PDFA-4F.
* Produces a detailed report of compliance violations and associated PDF objects.
* Keeps the required changes to a minimum, preserving the consistency of the original.
* Tracks all changes to allow for automatic assessment of data loss.
* Allows user to customize compliance checks or omit specific changes during the conversion process.
* Preserves tags, logical structure, and color information in existing PDF documents.
* Supports user-defined color profiles.
* Offers automatic font substitution, embedding, and subsetting options.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/pdf-a/convert.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
