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

Free Support Forum - aspose.com

How to add a top bar "signed" to a .pdf document

Hi
Is it possible to sign a .pdf document via aspose in a way when a top bar “Signed and all signatures are valid” is shown? I expect it to look like this:
nice_signature_example.png (5.1 KB)

The only example I have found https://docs.aspose.com/display/pdfnet/Working+with+Signature+in+a+PDF+File
explains how to add a signature rectangle on the page and in this case top bar is not shown

Hi Tetiana,

Thanks for contacting support.

Aspose.Pdf for .NET supports the features to digitally sign the PDF documents. I have signed one of my sample PDFs with following code snippet and observed a top bar in the document, when opened in Adobe Reader.

string pbxFile = dataDir + "mykey2.pfx";
string inFile = dataDir + @"DigitallySign.pdf";
string outFile = dataDir + @"DigitallySign_out.pdf";
using (Document document = new Document(inFile))
{
 using (Facades.PdfFileSignature signature = new Facades.PdfFileSignature(document))
 {
  PKCS7 pkcs = new PKCS7(pbxFile, "{password}"); // Use PKCS7/PKCS7Detached objects
  DocMDPSignature docMdpSignature = new DocMDPSignature(pkcs, DocMDPAccessPermissions.FillingInForms);
  System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 100);
  // Set signature appearance
  signature.SignatureAppearance = dataDir + @"aspose-logo.jpg";
  // Create any of the three signature types
  signature.Certify(1, "Signature Reason", "Contact", "Location", true, rect, docMdpSignature);
  // Save output PDF file
  signature.Save(outFile);
 }
}

Please check following screenshot of top bar which I have observed after signing the document.

Top_Bar.png (18.6 KB)

However, in reference to the image which you have shared, would you please add more details, like which type of signing PDF you require and please share a sample document so that we can check the scenario in our environment and address it accordingly.


Best Regards,
Asad Ali