We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with PDF attachments with signed document

Hi Support,
I am getting an issue regarding PDF file attachments using Aspose.PDF.Document version 17.9.
My scenario is I have signed the document and add an attachment in the signed version of PDF.
After adding attachment, my PDF signature gets corrupt.
Could you please guide me in this scenario.

Code snippet for adding attachment is as follows:

        using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(new MemoryStream(_documentBytes, true)))
        using (MemoryStream msDoc = new MemoryStream(fileAttachement.Bytes))
        using (Aspose.Pdf.FileSpecification fileSpecification = new 
        Aspose.Pdf.FileSpecification(msDoc, fileAttachement.Name))
        {
            pdfDocument.EmbeddedFiles.Add(fileSpecification);
            using (MemoryStream msOutput = new MemoryStream())
            {
                pdfDocument.Save(msOutput);
                fileAttachement.DocBytes = msOutput.ToArray();
                _documentBytes = fileAttachement.DocBytes;
            }
        }

Regards

@Wahaj_Khan,

Thanks for contacting support.

Can you please share source file along with error details so that we may further investigate to help you out. Also before sharing requested information can you please try to use Aspose.PDF latest version 20.2 on your end.

Hi @Adnan.Ahmad
You can find the source files with and without attachment results from the following link:
https://ascertia0-my.sharepoint.com/:f:/g/personal/muddassir_awan_ascertia_com/Evx-SrZUp4tCsq8FVAyWDqcBOlu8IwAM2elkkni4pgWs3w?e=axM3PR

My scenario is I have signed the document and check the signature in Adobe and the signature is Valid. After that I have added attachment in the document and check the siganture again in Adobe, the existing signature got corrupt.

Regards

@Wahaj_Khan,

I have observed issue you mentioned and have logged it as PDFNET-47817 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.