Sign Empty Field

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for Java (v8)  /  Re: Sign Empty Field

DynamicPDF Merger for Java (v8) Forum

 Sep 10 2017 2:33 PM
Using dynamic pdf , can I sign empty field present in pdf ? Kindly suggest
 Sep 11 2017 9:26 AM
Posted by a ceTe Software moderator
Hello,

If you have acro form fields like  text field, checkbox, radio button, etc, then you can fill them dynamically using DynamicPDF Merger for Java product.  You can refer to the documentation on form filling here.

It is not possible to sign the existing signature field using DynamicPDF Merger product. You will need to remove the existing signature field then add a new signature field and sign it dynamically. Below is the code sample for removing the existing signature field and adding new signature filed and signing it in the merged output PDF.

           //Code sample to remove existing signature field and add a new one.
            PdfDocument pdf = new PdfDocument("File path for input PDF");
            MergeDocument mergeDocument = new MergeDocument(pdf);
            int pageNumber=pdf.getForm().getFields().getPdfFormField("signature form field name").getOriginalPageNumber()-1;
            Page page=mergeDocument.getPages().getPage(pageNumber);
            float xPos = pdf.getForm().getFields().getPdfFormField("signature form field name").getX(page);
            float yPos = pdf.getForm().getFields().getPdfFormField("signature form field name").getY(page);
            float width = pdf.getForm().getFields().getPdfFormField("signature form field name").getWidth();
            float height = pdf.getForm().getFields().getPdfFormField("SigF signature form field name field").getHeight();
            mergeDocument.getForm().getFields().getFormField("signature form field name").setOutput(FormFieldOutput.REMOVE);
            //Create & add Signature Form Field.
            Signature signature = new Signature("SigField1", xPos, yPos, width, height);
            page.getElements().add(signature);
            Certificate certificate = new Certificate("path for certificate file", "password");
            //Field name should be one of the signature field name
            mergeDocument.sign("SigField1", certificate);
            mergeDocument.draw("C://Temp//MyDocumentOutput.pdf");

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:53 PM.