Skip to content

dciug/auto-sign-pdfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto-sign all PDFs in the working directory using Adobe Acrobat (not Reader!).

Behaviour

Scans all PDFs in the folder and applies your digital ID signature to all of them:

  • If it finds a field labeled "Signature", applies it there
  • If not, creates a new signature at the top-left corner of the document.

Requirements

  1. Add tools/sdkAddSignature.js to the Javascripts folder from your Acrobat installation folder.
    • Example path: "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts"
  2. Restart Adobe Acrobat.
  3. There should now be a new command labeled "Add My Signature" under "Edit" › "Acrobat SDK JavaScript"
  4. Add your certificate.pfx into the same directory as SignPDF.exe.

Without .pfx

If you cannot export your .pfx certificate, you can use this version to prompt the user to select a certificate:

  1. Add ./tools/without_pfx/sdkAddSignature.js to the Javascripts folder from your Acrobat installation folder.
    • Example path: "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts"
  2. Restart Adobe Acrobat.
  3. There should now be a new command labeled "Sign all active documents" under "Edit" › "Acrobat SDK JavaScript"
  4. This will do two things:
    • Retrieve your certificates. Select one.
    • Scan the currently active documents for signature fields. Select one or choose to add a new field at the top-left corner of your screen.
  5. Input your password

No external executable required.

Add executable to Explorer context menu

NOTE: You can also refer to this answer from StackOverflow.

  1. Open the Registry editor (regedit.msc).
  2. Navigate to Computer\HKEY_CLASSES_ROOT\directory\background\shell.
  3. Right click on 'shell' › 'New' › 'Key'.
  4. Give it a name (e.g: 'Sign all PDFs from this directory'). This is how this command will appear in the Explorer context menu. You can change it later.
  5. Right Click on this new item › 'New' › 'Key'.
    • Set it to 'command'.
  6. Right click on '(Default)' and point it to the executable.

Add icon to context menu item (Optional)

  1. (Optional) Right click on item from step [4] above.
  2. Right click › 'New' › 'String Value'.
    • Set it to 'Icon'.
  3. Double click on it and point it to the Adobe Acrobat executable.

You should now see a new context menu command called 'Sign all PDFs from this directory' with the Adobe Acrobat icon.

How to use

  1. Open all PDFs from the working directory in Adobe Acrobat (important!).
  2. Right click in Explorer.
  3. Click on 'Sign all PDFs from this directory'.

Development

Generate a test certificate

  1. Running tools/gen_cert.ps1 in PowerShell generates a test certificate called "MY_TEST_CERTIFICATE.pfx"
    • The password is password.
  2. Move this certificate in the same directory as SignPDF.exe.

Generate the executable installer

  1. Go to tools directory.
  2. Run ps2exe .\install.ps1 (assumming ps2exe is installed in PowerShell).

Tested with:

  • Windows 10 19044.2006
  • Adobe Acrobat Standard DC (32 bit)
  • Visual Studio Community 2022 with .Net Framework 4.8

Resources:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published