0

I sign a PDF file with multiple signatures using Aspose.PDF for .NET.When I open the file by Adobe Reader, all signatures show: "The Document has been altered or corrupted since the Signature was appiled" except the last one.How can I do?Thanks! This is my code base on the official example

https://docs.aspose.com/pdf/net/improved-and-flexible-pdf-signing-mechanism/

            string file = "E:\\Temp\\0.pdf";
            // Create FormEditor object
            FormEditor editor = new FormEditor();
            editor.BindPdf(file);
            // Add signature fields
            editor.AddField(FieldType.Signature, "1", 1, 3149, 1390, 3324, 1477);
            editor.AddField(FieldType.Signature, "2", 1, 3164, 1302, 3309, 1389);
            // Save the form
            file = "E:\\Temp\\1.pdf";
            editor.Save(file);

            for (int i = 1; i < 3; i++)
            {
                string signImageFile = "";
                PKCS7Detached pkcs = null;
                PdfFileSignature pdfSign = new PdfFileSignature();
                System.Drawing.Rectangle signRect = new System.Drawing.Rectangle();

                if (i == 1)
                {
                    pkcs = new PKCS7Detached("E:\\Sign\\1.p12", "111111");
                    signImageFile = "E:\\Sign\\1.png";
                    signRect = new System.Drawing.Rectangle(3149, 1390, 175, 87);
                }
                else if (i == 2)
                {
                    pkcs = new PKCS7Detached("E:\\Sign\\2.p12", "222222");
                    signImageFile = "E:\\Sign\\2.png";
                    signRect = new System.Drawing.Rectangle(3164, 1302, 145, 87);
                }
                pkcs.ShowProperties = false;

                pdfSign.BindPdf(file);
                pdfSign.Sign(i.ToString(), "", "", "", pkcs);
                pdfSign.SignatureAppearance = signImageFile;
                file = Path.Combine("E:\\Temp", (i + 1).ToString() + ".pdf");
                pdfSign.Save(file);
                pdfSign.Close();
            }
        
giman
  • 1
  • 1
  • The issue you are facing needs to be properly investigated and addressed. For this purpose, sample source PDF and PFX file(s) are required. Please note that it is recommended to post such issues in the official Aspose.PDF forum (https://forum.aspose.com/c/pdf) where they can be addressed and tracked appropriately for the fix. You can also share your file securely over there. It is requested that you create a post in the Aspose.PDF forum with sample file(s) so that we can proceed to assist you further. This is Asad Ali and I work as Developer Evangelist at Aspose. – Asad Ali Mar 12 '21 at 00:09
  • Hi @AsadAli,thank you for your help.I already shown my code on my question,Can you tell me what's wrong with this code ? – giman Mar 15 '21 at 07:12
  • we believe that we have responded to your similar inquiry (https://forum.aspose.com/t/226736/2) in our forum. You may please follow up there. – Asad Ali Mar 15 '21 at 18:30
  • Thanks,the problem was solved,please see https://forum.aspose.com/t/aspose-pdf-for-net-multiple-signatures-all-signatures-are-invalid-except-the-last-one/226736 – giman Mar 23 '21 at 03:09

0 Answers0