Skip to content

Instantly share code, notes, and snippets.

@brainrake
Last active February 10, 2026 08:11
Show Gist options
  • Select an option

  • Save brainrake/a88df052c4a83dda8817bf318f3666fe to your computer and use it in GitHub Desktop.

Select an option

Save brainrake/a88df052c4a83dda8817bf318f3666fe to your computer and use it in GitHub Desktop.
Sign multiple PDFs on Windows using PKCS#11

Sign all PDFs in a directory on Windows

This process uses jsignpdf.

Install Java

Download Java JRE or JDK (Java 8 or newer)

https://www.oracle.com/java/technologies/downloads/

Install using defaults. Log out and log back in to Windows (or restart).

Verify Installation

Open Command Prompt (press Win+R, type cmd.exe and press Enter).

Type this command to test thata Java was installed correctly:

java -version

Install jSignPdf

Go to:

Go to https://sourceforge.net/projects/jsignpdf/ and download the latest jSignPdf-x.y.z.jar. Save it to someplace convenient, e.g. C:\jsignpdf\.

Test it by running it in the command prompt:

java -jar C:\jsignpdf\jSignPdf-2.2.1.jar

Sign single PDF

Note: file will be replaced

  • replace C:\jsignpdf\jSignPdf-2.2.1.jar with the path to jSignPdf
  • replace C:\certpath\certn.p12 with path to your certificate
  • replace YourCertPassword with your certificate password
  • replace C:\pdfs\file.pdf with the path to the file to sign

Run the following in Command Prompt, with values replaced

java -jar C:\jsignpdf\jSignPdf-2.2.1.jar ^
  -kst PKCS12 ^
  -ksf C:\certpath\cert.p12 ^
  -ksp YourCertPassword ^
  -i C:\pdfs\file.pdf ^
  -o C:\pdfs\file.pdf

Sign multiple PDFs

Run the following, with replacements as above:

for %f in ("C:\pdfs\*.pdf") do (
  java -jar C:\jsignpdf\jSignPdf-2.2.1.jar ^
    -kst PKCS12 ^
    -ksf C:\certpath\cert.p12 ^
    -ksp YourCertPassword ^
    -i "%f" ^
    -o "%f"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment