IRONSOFTWAREHOME
Digital Signatures
from ironpdf import *

# Cryptographically sign an existing PDF in 1 line of code!
PdfSignature(r".\certificates\IronSoftware.p12", "123456").SignPdfFile("any.pdf")

##### Advanced example for more control #####

# Step 1. Create a PDF
renderer = ChromePdfRenderer()
doc = renderer.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 = PdfSignature(r"certificates\IronSoftware.pfx", "123456")

# Step 3. Optional signing options and a handwritten signature graphic
signature.SigningContact = "support@ironsoftware.com"
signature.SigningLocation = "Chicago, USA"
signature.SigningReason = "To show how to sign a PDF"

# Step 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.Sign(signature)

# Step 5. The PDF is not signed until saved to file, steam or byte array.
doc.SaveAs("signed.pdf")
pip install ironpdf
Digital Signatures

Digital Signatures

This Python code demonstrates how to use a PDF library, such as PyPDF2, to cryptographically sign an existing PDF and create a PDF with a digital signature.

How to Generate a Digital Signature in Python

  1. Download a Python module to generate a digital signature. You can use libraries like PyPDF2 and PyPDF4, which are Python libraries for reading and writing PDF files, but for signing you might prefer something like reportlab in combination with PyPDF2 for digital signatures.
  2. Render a new PDF document. Use reportlab to create a new PDF or modify an existing one.
  3. Instantiate the PdfSignature class and import the digital certificate. The code snippet below shows how you might do it using a hypothetical PdfSignature class. Replace it with the actual method of adding a signature from the library you choose.
  4. Add additional information as needed. Specify metadata, appearance, or location for the signature.
  5. Use the sign method to sign the document. Below is a Python code using reportlab to create a PDF and PyPDF2 to attach a digital signature.

Note: Signing a PDF with a digital signature using reportlab and PyPDF2 is a complex process that may involve different libraries depending on the specific requirements. Ensure you have the necessary certificates and understanding of cryptographic principles while implementing this.

Explore the Digital Signature PDF Example on GitHub
View on GitHub

Ready to Get Started?

Version:2026.9just 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 IronPDF
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
Python Module Download for PDF
Install with pip

Version: 2026.9

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.9

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

Licenses from $999