Remove PDF/A Compliance

Hi,

I am using Aspose.PDF .NET to optimise some PDFs. The process is the system will open a PDF file and set PageNodesToBalancedTree() as well as execute OptimizeResources(). When the file is saved, the PDF is converted to PDF/A. I have tried to use RemovePdfaCompliance() to remove PDF/A compliance on save but it is not working properly. FYI, the input PDF file does not have the PDF/A compliance.

using (var pdfDocument = new Document(fileName))
            {
                pdfDocument.PageNodesToBalancedTree(30);
                var optimizeOptions = new Pdf.Optimization.OptimizationOptions();
                optimizeOptions.RemoveUnusedObjects = true;
                pdfDocument.OptimizeResources(optimizeOptions);
                pdfDocument.Flatten();
                pdfDocument.RemovePdfaCompliance(); // Not working
                pdfDocument.Save(System.IO.Path.Combine(_dataDir, "test.pdf"));
            }

Is there any other ways I can remove the PDF/A compliance on saved PDF files?

Thank you!

@thong.le

If input PDF is not a PDF/A format, it is strange why it is being converted into PDF/A. Are you sure you are not performing any other code routine in between? Can you please share the sample PDF with us? We will test the scenario in our environment and address it accordingly.

Is there any other ways I can remove the PDF/A compliance on saved PDF files?

No, there is no other way at the moment in API to remove the PDF/A compliance.

sample_pdf.pdf (1.0 MB)

Thank you for your reply!

My apologies! I believe the input file (attached above) has the PDF/A compliance.

Can you have a look at this sample PDF and see whether we can remove the PDF/A compliance?

Thank you!

@thong.le

We opened the file in Adobe Reader and cannot see PDF/A compliance bar. Can you please share how you are checking for PDF/A compliance at your end?

Sorry for the confusion!

The sample_pdf.pdf file in my previous response is the input file. Please see the output PDF generated by Aspose PDF below.

sample_pdf_output.pdf (978.9 KB)

Thank you!

@thong.le

We were able to replicate the issue in our environment using the latest version of the API that the output PDF was still PDF/A compliant even when we removed it using below code.

Document doc = new Document(dataDir + "sample_pdf_output.pdf");
doc.RemovePdfaCompliance();
doc.Save(dataDir + "2434_Output_PDFAremoved.pdf");

Therefore, an issue as PDFNET-56083 has been logged in our issue tracking system. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thank you Asad!

As we are implementing Aspose.PDF in our project, if possible, can you give us an estimation of next release for the correction?

Thank you!

@thong.le

The ticket has recently been logged in our issue tracking system and it will be prioritized on a first come first serve basis. As soon as we make some progress towards ticket resolution or we have any news about fix ETA, we will inform you in this forum thread. Please spare us some time.

1 Like

Hi @asad.ali

I can see the ticket status is updated to Resolved. However, I still getting the error when I generated the PDF.
image.png (3.3 KB)

FYI, I am on Aspose.PDF 24.4.0.

Can you help a check again?

Thank you,
Thong

@thong.le

The ticket is resolved in 24.5 version of the API which has not been yet released. It will be published in May, 2024. Once it is available, we will send you the notification in this forum thread.