Convert PDF/A to PDF format

Convert PDF/A document to PDF

Convert PDF/A document to PDF means removing PDF/A restriction from the original document. Class Document has method RemovePdfaCompliance(..) to remove the PDF compliance information from input/source file.

public static void runPDFA_to_PDF() {
    String pdfaDocumentFileName = Paths.get(DATA_DIR.toString(), "PDFAToPDF.pdf").toString();
    String documentFileName = Paths.get(DATA_DIR.toString(), "PDFAToPDF_out.pdf").toString();

    // Create Document object
    Document document = new Document(pdfaDocumentFileName);

    // Remove PDF/A compliance information
    document.removePdfaCompliance();

    // Save output in XML format
    document.save(documentFileName);
    document.close();
}

This info also removes if you make any changes in the document (e.g. add pages). In the following example, the output document loses PDF/A compliance after the page adding.

public static void runPDFAtoPDFAdvanced() {
    String pdfaDocumentFileName = Paths.get(DATA_DIR.toString(), "PDFAToPDF.pdf").toString();
    String documentFileName = Paths.get(DATA_DIR.toString(), "PDFAToPDF_out.pdf").toString();

    // Create Document object
    Document document = new Document(pdfaDocumentFileName);

    // Adding a new (empty) page removes PDF/A compliance information.
    document.getPages().add();

    // Save updated document
    document.save(documentFileName);
    document.close();
}