Signed pdf cannot be converted to pdf/a

I have problems using Aspose Java PDF to create pdf/a document from a standard pdf document.

When using setHandleSignatureChange(true) I get an exception (as expected) because the attached document is a signed document.
When not setting this property it gets successfully converted but the result is not a pdf/a.
Used: PdfFormat.PDF_A_1A

sample01.pdf (213.0 KB)

@d1-admin

Are you using the latest version i.e. 22.10 and are you setting some other specific conversion options as well? Can you please share complete sample code snippet with us as well? We will test the scenario in our environment and address it accordingly.

Yes, using 22.10 pdf for Java.

I’m doing the following. Tried it separated from my application - but still the same

File testFile = new File("/tmp/sample01 (5).pdf");    
File logFile = new File("/tmp/out.log");    
File outputFile = new File("/tmp/result.pdf");    
    
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(new FileInputStream(testFile));    
    
doc.setHandleSignatureChange(false);    
doc.setLinearized(true);    
boolean convert = doc.convert(logFile.getAbsolutePath(), PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);    
System.out.println(convert);    
    
doc.save(new FileOutputStream(outputFile));

@d1-admin

We are checking it and will get back to you shortly.

Hi,

how is the status on this issue?

@d1-admin

We were to replicate the issue in our environment. Therefore, it has been logged as PDFJAVA-42277 in our issue tracking system for the sake of correction. We will further 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.

How is the status of this issue?

@d1-admin

The ticket has recently been logged in our issue tracking system and it is pending for analysis. We will surely investigate and fix the ticket on first come first serve basis. You will surely be notified via this forum thread as soon as some progress is made towards ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi,

any update regarding this issue?

@d1-admin

The investigation of this ticket is underway and as soon as we have some news about its resolution ETA, we will share with you in this forum thread. Please spare us some time.

We are sorry for the inconvenience.

Hi,

Can you please give us a rough ETA? We have a customer waiting for this fix and they are escalating the issue currently.

Thanks.

@d1-admin

We are afraid that we are not able to share any reliable ETA at the moment because the ticket is currently under the phase of the investigation. As soon as its analysis is completed, we will share updates with you about its resolution ETA. We highly appreciate your patience and comprehension in this matter.

We apologize for the inconvenience.

Hi, do you have news on this?

@d1-admin

Yes, this is expected behavior. A document that contains signature can’t be converted to PDFA or any other pdf format or be changed due to restrictions, this is security rule that protect the original content of the document.

You should remove signature (if document restrictions and certificate allow that) after that convert the document.

And then the converted to PDF_A_1A file can be signed again.

 Document doc = new Document(dataDir+"sample01.pdf");

        com.aspose.pdf.facades.PdfFileSignature signature = new com.aspose.pdf.facades.PdfFileSignature(doc);
        java.util.List<String> signNames = signature.getSignNames();
        for (String signName : signNames) {            
            signature.removeSignature(signName);
        }
        doc.save(dataDir+"temp_noSign.pdf");

        Document doc2 = new Document(dataDir+"temp_noSign.pdf");
        doc2.setHandleSignatureChange(false);    
        doc2 .setLinearized(true);    
        boolean convert = doc2 .convert(logFile.getAbsolutePath(), PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);    
        System.out.println(convert);    

        doc2.save(dataDir+"temp_converted.pdf");

 Document doc3 = new Document(dataDir+"temp_noSign.pdf");

        PdfFileSignature signature2= new PdfFileSignature(doc3);

        PKCS7 pkcs = new PKCS7(dataDir+"certificate.pfx", "Password");
        //setup position or other signature details
        signature2.setSignatureAppearance(dataDir+"image.jpg");
        signature2.sign(1, true, new java.awt.Rectangle(300, 100, 400, 200), pkcs);
        // Save output PDF file
        signature2.save(new FileOutputStream(outputFile));

Although the signature problem can be solved in this way, the document also has a complex internal structure, and the converted document does not pass PDF_A_1A validation. The same problem was found in the project for .NET. The related issue has been created: i.e. PDFNET-54036

@d1-admin

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): PDFNET-54036

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.

Ok, thanks for the information

Hello, considering we now have an active support membership, we would ask you to reprioritize this ticket and please provide us with a reliable ETA for fixing the issue. Should we create a new ticket in the helpdesk portal? Thank you. Best regards, D1 team

@d1-admin

Yes, you need to create a new topic in helpdesk with the reference of ticket ID that has been linked and logged here. Your existing ticket will be escalated to the highest priority accordingly.

The issues you have found earlier (filed as PDFNET-54036) have been fixed in Aspose.PDF for .NET 23.12.

The issues you have found earlier (filed as PDFJAVA-42277) have been fixed in Aspose.Pdf for Java 24.1.