Some PDF wrongly convert to PDF/A-2u

Hello,

There are a few cases where some PDF v1.4, v1.5 and V1.6 wrongly convert to PDF/A-2u. After the conversion is done with no errors, the file is not compliant (checked with verapdf).
Attached is the original file and the veraPDF report.
It could be related to this issue from 2018 Convert PDF to PDF/A-2u
Is there any ideas on this issue ?
converted.pdf (1,6 Mo)
original.pdf (1,1 Mo)
xmlReport.zip (1,1 Ko)

@spmbicheyre

Could you please check attached file with verapdf as it was generated using the latest version of the API and share the results with us?
converted.pdf (3.3 MB)

Thank you for your reply. Your converted file seems to validate properly.
I tried in a sample java project (based on Aspose examples), running com.aspose.aspose-pdf 25.2, the PDF still fails to validate properly after conversion.
Here is how I proceed with the conversion, maybe something is wrong ?

 Document document = new Document(dataDir + "original.pdf");

        PdfFormatConversionOptions conversionOptions = new PdfFormatConversionOptions(PdfFormat.PDF_A_2U);

        File outputFile = new File(dataDir + "converted.pdf");
        try {
            outputFile.createNewFile();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        try (FileOutputStream out = new FileOutputStream(outputFile, false)) {
            document.getFontUtilities().subsetFonts(FontSubsetStrategy.SubsetAllFonts);
            document.validate(conversionOptions);
            boolean isConverted = document.convert(conversionOptions);
            if (isConverted) {
                document.optimize();
                document.save(out);
            }
            document.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

@spmbicheyre

Below is the basic code snippet that we used to test the scenario and generate previously shared PDF output.

Document doc = new Document(dataDir + "original.pdf");
doc.convert(dataDir + "log.xml", PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
doc.save(dataDir + "converted.pdf");

Please try using the code like above and let us know if it helps.

Hello, it seems to work with your snippet. Trying different things, the bug comes from the document.optimize()

@spmbicheyre

With the latest version Document.Optimize() is not causing any exception in our environment. We tried using it before saving the file.

Document doc = new Document(dataDir + "original.pdf");
doc.convert(dataDir + "log.xml", PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
doc.optimize();
doc.save(dataDir + "converted.pdf");

It is not causing any exception but it is failing the validation of the converted example PDF in my test environment
This snipped does not validate even though it is not throwing any exception

        try (Document doc = new Document(dataDir + "original.pdf")){
            doc.convert(dataDir + "log.xml", PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
            doc.optimize();
            doc.save(dataDir + "converted.pdf");
        }

@spmbicheyre

Can you please share the screenshots of validation error in veraPDF? We will investigate the issue accordingly.

Attached is a screenshot of the validation reports of the pdf generated using the snippet above.
The error seems to be the following :

Specification: ISO 19005-2:2011, Clause: 6.6.4, Test number: 1	
The PDF/A version and conformance level of a file shall be specified using the PDF/A Identification extension schema

image.png (46,9 Ko)

@spmbicheyre

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFJAVA-44834

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.