How to Convert PDF to PDF/A in C#, VB.NET

This article demonstrates how to convert PDF to PDF/A-1A, 2A, 3A, 1B, 2B and 3B compliant PDF using Spire.PDF for .NET.

Detailed Steps:

Step 1: Create a PdfStandardsConverter instance, passing in the input file path as a parameter.

PdfStandardsConverter converter = new PdfStandardsConverter(@"C:\Users\Administrator\Desktop\sample.pdf");

Step 2: Invoke ToPdfA1A method to convert PDF to PDFA1A compliant PDF. More methods used for converting PDF to PDFA2A, PDFA3A, PDFA1B, PDFA2B, and PDFA3B can be found under the PdfStandardsConverter object.

converter.ToPdfA1A("ToPdfA1A.pdf ");

Full Code:

[C#]
using System;
using Spire.Pdf.Conversion;

namespace ConvertPdf2Pdfa
{
    class Program
    {
        static void Main(string[] args)
        {
            //Specify input file path
            String inputFile = @"C:\Users\Administrator\Desktop\sample.pdf";

            //Specify output folder
            String outputFolder = @"C:\Users\Administrator\Desktop\Output\";

            //Create a PdfStandardsConverter instance, passing in the input file as a parameter
            PdfStandardsConverter converter = new PdfStandardsConverter(inputFile);

            //Convert to PdfA1A
            converter.ToPdfA1A(outputFolder + "ToPdfA1A.pdf");

            //Convert to PdfA1B
            converter.ToPdfA1B(outputFolder + "ToPdfA1B.pdf");

            //Convert to PdfA2A
            converter.ToPdfA2A(outputFolder + "ToPdfA2A.pdf");

            //Convert to PdfA2B
            converter.ToPdfA2B(outputFolder + "ToPdfA2B.pdf");

            //Convert to PdfA3A
            converter.ToPdfA3A(outputFolder + "ToPdfA3A.pdf");

            //Convert to PdfA3B
            converter.ToPdfA3B(outputFolder + "ToPdfA3B.pdf");
        }
    }
}
[VB.NET]
Imports System
Imports Spire.Pdf.Conversion
 
Namespace ConvertPdf2Pdfa
    Class Program
        Shared  Sub Main(ByVal args() As String)
            'Specify input file path
            Dim inputFile As String =  "C:\Users\Administrator\Desktop\sample.pdf" 
 
            'Specify output folder
            Dim outputFolder As String =  "C:\Users\Administrator\Desktop\Output\" 
 
            'Create a PdfStandardsConverter instance, passing in the input file as a parameter
            Dim converter As PdfStandardsConverter =  New PdfStandardsConverter(inputFile) 
 
            'Convert to PdfA1A
            converter.ToPdfA1A(outputFolder + "ToPdfA1A.pdf")
 
            'Convert to PdfA1B
            converter.ToPdfA1B(outputFolder + "ToPdfA1B.pdf")
 
            'Convert to PdfA2A
            converter.ToPdfA2A(outputFolder + "ToPdfA2A.pdf")
 
            'Convert to PdfA2B
            converter.ToPdfA2B(outputFolder + "ToPdfA2B.pdf")
 
            'Convert to PdfA3A
            converter.ToPdfA3A(outputFolder + "ToPdfA3A.pdf")
 
            'Convert to PdfA3B
            converter.ToPdfA3B(outputFolder + "ToPdfA3B.pdf")
        End Sub
    End Class
End Namespace