Some test text!

Signing a documentkeyboard_arrow_down

Sign a PDF document

To sign an existing approval signature field in a PDF Document:

// Open an existing PDF
PDFDoc doc = new PDFDoc(docpath);

// Retrieve the unsigned approval signature field.
Field found_approval_field = doc.getField(approval_field_name);
DigitalSignatureField approval_digsig_field = new DigitalSignatureField(found_approval_field);

// (OPTIONAL) Add more information to the signature dictionary.
approval_digsig_field.setLocation("Vancouver, BC");
approval_digsig_field.setReason("Document approval.");

// (OPTIONAL) Add an appearance to the signature field.
Image img = Image.create(doc, appearance_img_path);
SignatureWidget approval_signature_widget = new SignatureWidget(found_approval_field.getSDFObj());

// Prepare the signature and signature handler for signing.
approval_digsig_field.signOnNextSave(private_key_file_path, keyfile_password);

// The actual approval signing will be done during the following incremental save operation., SDFDoc.SaveMode.INCREMENTAL, null);

Digitally sign PDF files
Full code sample which demonstrates using the digital signature API to digitally sign and/or certify PDF documents.

Get the answers you need: Support


Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more