Search code examples
javaasposeaspose.pdf

Aspose Java PDF Add Signature Field


Using Aspose Java PDF does anyone know how to add a PDF signature field to an existing template? Thanks!


Solution

  • @Shaun, In order to add Signature field, please try using following code snippet.

    //Open document
    Document pdfDocument = new Document("Input.pdf");
    
    //Create a field
    SignatureField signatureField = new SignatureField(pdfDocument.getPages().get_Item(1), new com.aspose.pdf.Rectangle(100, 200, 300, 300));
    signatureField.setPartialName("signature1");
    
    //Add field to the document
    pdfDocument.getForm().add(signatureField, 1);
    
    //Save modified PDF
    pdfDocument.save("Output.pdf");
    

    However if you need to add digital signature in existing PDF file, please follow the instructions specified over Add Digital Signature to PDF File

    My name is Nayyer and I work as developer evangelist at Aspose.