![]() The code sample below shows how to retrieve signed form field names and apply a new signature to the first field: Use the GetSignatureFieldNames method to retrieve signed field names.Ĭall the PdfDocumentSigner.ClearSignatureFields() method to clear all signature fields. Call the PdfDocumentSigner.ClearSignatureField method with the form field’s name passed as a parameter. You can remove a signature from a form field and sign it with another signature. View Example: How to use a custom signer class to apply signatures to the PDF Document Re-Sign the Form Field If you need to calculate a document hash in a custom manner, you can use a custom digest calculator instead of DigestCalculator with a custom PKCS#7 signature builder: View Example: How to use Azure Key Vault API to sign a PDF document You can create the Pkcs7SignerBase descendant and use a custom PKCS#7 signature builder: Signer.SaveDocument("SignedDocument.pdf", signatures) SantuzzaSignature.Name = "Santuzza Valentina" SantuzzaSignature.Location = "Australia" SantuzzaSignature.SetImageData(File.ReadAllBytes("Signing Documents//SantuzzaValentina.jpg")) Var santuzzaSignature = new PdfSignatureBuilder(pkcs7Signature, "Sign") Apply a signature to an existing form field: Specify an image and signer information:ĬooperSignature.SetImageData(File.ReadAllBytes("Signing Documents//JaneCooper.jpg")) ĬooperSignature.Reason = "Acknowledgement" Var cooperSignature = new PdfSignatureBuilder(pkcs7Signature, signatureFieldInfo) Apply a signature to a newly created signature field: Pkcs7Signer pkcs7Signature = new Pkcs7Signer("Signing Documents/certificate.pfx", "123", Using (var signer = new PdfDocumentSigner("Document.pdf")) The code sample below applies a digital signature to a new and existing form field and signs a document with these signatures: Refer to the previous section for a code sample.Īpplies the signature(s) and saves the document. Use the PdfSignatureFieldInfo object to create a new form field. If the field with the specified name does not exist, an ArgumentException is thrown. Specify the signature field’s name in the object’s constructor to sign this field. Use the HashAlgorithmType enumeration to specify the signatures hashing algorithm.Īpplies a signature to a form field. Specify the signature certificate and password in the object’s constructor. Pass the document to sign to the object’s constructor.Ĭreates a PKCS#7 signature. The table below lists API used to sign a form field: API The PdfDocumentSigner class allows you to sign and save a document. The PDF Document API supports PKCS#7 signatures with X.509 certificates and document-level time timestamps. Use the PdfSignatureBuilder class to apply a signature to the form field. SignatureFieldInfo.RotationAngle = PdfAcroFormFieldRotation.Rotate90 SignatureFieldInfo.SignatureBounds = New PdfRectangle(10, 10, 150, 150) SignatureFieldInfo.Name = "SignatureField" ' Specify the field's name, location and rotation angle: ' Create a signature field on the first page:ĭim signatureFieldInfo = New PdfSignatureFieldInfo(1) SignatureFieldInfo.SignatureBounds = new PdfRectangle(10, 10, 150, 150) Specify the field's name, location and rotation angle: ![]() Var signatureFieldInfo = new PdfSignatureFieldInfo(1) Create a signature field on the first page:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |