Convert PDF to PDF/A in Java

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

import com.spire.pdf.conversion.PdfStandardsConverter;

public class ConvertPdfToPdfA {
    public 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");
    }
}