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

Free Support Forum - aspose.com

Add Signature to PDF

hi,

we are trying to add a Signature to a PDF, the PDF is generated, but it comes with a warning “at least 1 signature is invalid”. we cannot add the certificate to the trusted list.
The topic is very similar to At least one signature is invalid message

After we first open the PDF, We performed following steps:
Untitled.png (4.6 KB)

  • Right Click over Signatures and goto Signature Properties

  • Press Show Signer Information button in popup

  • Noting happens

code

using (Document document = new Document(docStream))
{
using (PdfFileSignature signature = new PdfFileSignature(document))
{
Signature sing = new PKCS7Detached(@“c:\path\to*.pfx”, password);
signature.Sign(1, false, new System.Drawing.Rectangle(10, 10, 200, 200), sing);
// Save output PDF file
signature.Save(signedOutStream);
}
}

@frigo

I request you to share a sample application so that we may try to reproduce the same on our end.

hi Fayyaz,

I got it to work.
I was encrypting the PDF after I had signed it.
and that breaks the signature.

so advice for every one, if you are sinning a PDF, that is the last thing you do.

@frigo

It’s good to hear that things are fine on your end.