We are creating a product where one user sends PDF form to another user, and then the receiver user fills out the PDF form inside our web application, signs the forms and then sends the form. We, the developer, wont know where the signature field will be. How do we implement that? Is it possible to do so with this library?
You can add signature field to existing PDF file with the following code:
//Open document Document pdfDocument = new Document("Input.pdf"); //Create a field SignatureField signatureField = new SignatureField(pdfDocument.Pages, new Aspose.Pdf.Rectangle(100, 200, 300, 300)); signatureField.PartialName = "signature1"; //Add field to the document pdfDocument.Form.Add(signatureField, 1); //Save modified PDF pdfDocument.Save("Output.pdf");
This is how you can know the coordinates of signature field. Then you can sign it as explained in How to digitally sign PDF article.