IRONSOFTWAREHOME
Adding Signatures to PDFs


// Step 1. Create a PDF
PdfDocument pdf = PdfDocument.renderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");

// Step 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
// Read: https://helpx.adobe.com/acrobat/using/digital-ids.html
Signature signature = new Signature("Iron.pfx", "123456");

// Step 3. Optional signing options and a handwritten signature graphic
signature.setSigningContact("support@ironsoftware.com");
signature.setSigningLocation("Chicago, USA");
signature.setSigningReason("To show how to sign a PDF");
File imageFile = new File("handwriting.png");
byte[] imageBytes = Files.readAllBytes(imageFile.toPath());
signature.setSignatureImage(imageBytes, new Rectangle(100, 200, 250, 100));

// Step 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
SignatureManager signatureManager = pdf.getSignature();
signatureManager.SignPdfWithSignature(signature);

// Step 5. The PDF is not signed until saved to file, stream or byte array.
pdf.saveAs("signed.pdf");
mvn install
Adding Signatures to PDFs

Adding Signatures to PDFs

Java developers can add electronic and digital signatures to PDF documents programmatically using IronPDF for Java's Signature and SignatureManager classes.

For digital signatures, instantiate a new Signature class with the location of a valid .pfx or .p12 certificate, along with its password. Next, call the signPdfWithSignature method on the working PDF's SignatureManager to sign the PDF with the certificate.

IronPDF also supports the inclusion of signature images, in the form of computer-generated text images or digitized images of handwriting. Add such images to a signature with the addSignatureImage method prior to signing the PDF.

Need to add a handwritten signature on a PDF page instead? Use the HtmlStamper class to add HTML text and images to one or more pages of a document.

How to Add a Digital Signature to a PDF Programmatically in Java

  1. Install the IronPDF Java library to sign a digital signature on a PDF.
  2. Use intuitive APIs to load existing PDFs or render new PDFs.
  3. Create a Signature object and customize its granular information.
  4. Access SignatureManager by calling the getSignature method on the PDF instance.
  5. Sign the PDF with the signPdfWithSignature method in the SignatureManager instance.
Explore the Signature Class for Java Digital Signatures
View on GitHub

Ready to Get Started?

Version:2026.8just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Java Maven Library for PDF
Install with Maven

Version: 2026.8

<dependency>
   <groupId>com.ironsoftware</groupId>
   <artifactId>ironpdf</artifactId>
   <version>2026.8.2</version>
</dependency>
https://central.sonatype.com/artifact/com.ironsoftware/ironpdf/2026.8.2
or
Java PDF JAR
Download JAR

Version: 2026.8

Manually install into your project