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

Free Support Forum - aspose.com

Add signature field to existing PDF file in Java using Aspose.PDF for Java

Hi!


Can I get a simple example of adding both a signature and an initial box to a PDF? I can’t seem to find a simple example for adding that type of field to a PDF. Thanks!

Hi Bob,


Thanks for your inquriy. You can add signature field in a PDF document as following.

//Open document<o:p></o:p>

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");


Please feel free to contact us for any further assistance.


Best Regards,