Sign Whole PDF Document Like Aspose.Words

Hi,


I’ve been using Aspose.Words to convert my documents to PDF format and digitally sign them - which works great!

Recently however, I’ve wanted to hold off on the signing, add some text stamps to the resulting PDF file and then sign it with Aspose.PDF. I can successfully sign the stamped PDF document, but it seems different than the one produced from Words - like the whole document isn’t signed. When I sign from Aspose.Words, Adobe Reader displays a nice blue ribbon across the top of the page with a green check-mark indicating the document is signed and valid. When I sign from Aspose.PDF, I don’t get the blue ribbon - just the signature panel I have to manually open.

Is there are way to apply a digital signature to the from Aspose.PDF similar to the one created from Words?

This is the code I’m currently using to sign the PDF:

//ms = MemoryStream();
FormEditor formEditor = new FormEditor(ms,ms);
formEditor.AddField(Aspose.Pdf.Facades.FieldType.Signature,
_digSig.Name, 1, 0, 0, 0, 0);
formEditor.Save();

PdfFileSignature pdfSigner = new PdfFileSignature();
pdfSigner.BindPdf(ms);
pdfSigner.Sign(_digSig.Name, _digSig.PKCS7);
pdfSigner.Save(path);


Hi Joel,

Thanks for using our products.

You can set the signature appearance using Aspose.Pdf. Please visit the following documentation links for more details ablout Signatures in PDF documents and check if it fits your need.

Moreover, if you still facing some issue kindly provide the sample document which shows the exact result you required.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

Hi Rashid,


Thanks for the quick reply, but I’m not interested in the signature appearance, in fact I don’t want it to show on the document at all.

I’m simply wondering how to duplicate the type of signature created by Aspose.Words when saving to PDF. A document signed with Aspose.Words gets Adobe Reader to display a nice blue signature bar when viewing the document, however docs signed with Aspose.PDF aren’t treated this way, though the signatures (from the signature panel) appear to be the same. I’ve attached a screenshot of the blue bar…

What is the difference between how Aspose.Words and Apsose.PDF sign a document? Why are the signatures treated differently by Reader?

Hello Joel,

Thanks for using our products.

Aspose.Words and Aspose.Pdf are both separate products and both have their own mechanism of generating PDF files and working with its objects. So there can be a case that these products have different appraoches while applying the signatues. Nevertheless, can you please share the issue that you are facing when signature is applied using Aspose.Pdf. We are really sorry for this inconvenience.

This is the issue. We have been signing documents with Aspose.Words and our users are accustomed to the blue signature bar appearing in Adobe Reader when they view them. Now we’re signing with Aspose.PDF and our users don’t think the PDFs are signed (even though they are) because Reader doesn’t display this blue signature bar.


I’m having no trouble generating the signature with Aspose.PDF, just wondering why Reader treats the signatures differently. It appears some functionality has been stripped from PDF.Kit when it was merged with Aspose.PDF, I’m wondering if something like the property CertificationLevel which used to be available has something to do with it - but I must say I’m not too familiar with the inner workings of PDF documents and I never used PDF.Kit.

Hello Joel,


I have further investigated this issue and have found that when signing the PDF file using Aspose.Pdf for .NET and when viewing it in Adobe Reader, the blue signature bar is not displayed. However the signature is applied over the PDF file. I have logged an investigation task in our issue tracking system as PDFNEWNET-33205 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are really sorry for this inconvenience.

Hi,


I don’t know if there has been any progress with this issue, but I think I’ve figured out what the technical problem is, which may help a little…

Basically, there are two types of PDF signatures: a standard signature, and an MDP (modification detection and prevention) signature. Aspose.Words signs with an MDP signature, whereas I can only seem to create a standard signature with Aspose.PDF.

Is there any way to create an MDP signature with Aspose.PDF? If not, can I request the feature?

Thanks!
Joel

Hello Joel,


Thanks for sharing the detailed information regarding supported signatures types with Aspose.Pdf. Please note that I have shared this information with the development team and have inquired from them regarding support of MDP signatures by Aspose.Pdf for .NET. Soon you will be updated with the status of correction. We are sorry for the delay and inconvenience.

Hello Joel,


Thanks for sharing the details and sorry for the delayed response.

The product team has further investigated earlier reported PDFNET-33205 and I am afraid currently we cannot support MDP signature type. The document can only be signed using ordinary type of signature.

Should you have any further query, please feel free to contact.

@joelheinrich

Thanks for your patience.

We are glad to inform you that MDP signature is supported now in Aspose.Pdf for .NET 17.9. Please download latest version of the API from shared link and use following code snippet to certify the document as per your requirement.

const string myDir = @"c:\";
//create PdfFileSignature object and bind input and output PDF 
PdfFileSignature pdfSign = new PdfFileSignature(new Document(myDir + "test2_6_6_0.pdf"));
//create a rectangle for signature location
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 100);
//set signature appearance
pdfSign.SignatureAppearance = myDir + "Aspose.jpg";
//create any of the three signature types
PKCS1 signature = new PKCS1(myDir + "VirtualCabinetPortal.pfx", "password"); // PKCS#1 or
DocMDPSignature sig = new DocMDPSignature(signature, DocMDPAccessPermissions.FillingInForms);
pdfSign.Certify(1, "Signature Reason", "Contact", "Location", true, rect, sig);
//save output PDF file
pdfSign.Save(myDir + "test2_6_6_0-output.pdf");

In case of any further query, please feel free to let us know.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan