You could try this script in Script Editor.app. To test:
- put an encrypted PDF on your desktop, name
Input PDF.pdf
- set your password in property
thePassword
- run script
If the result is an unencrypted new PDF then the rest should be quite easy.
I’ve never used encrypted PDFs so I may be missing something, but it seems to work over here.
-- Test - Decrypt PDF
use AppleScript version "2.4"
use framework "Foundation"
use framework "Quartz"
use scripting additions
property thePassword : "test"
property theInputPath : POSIX path of (path to desktop) & "Input PDF.pdf" -- path of form "/Users/User/Desktop/Input PDF.pdf" (just in case you want to use something else than the desktop)
property theOutputPath : POSIX path of (path to desktop) & "Output PDF.pdf"
set thePDF to current application's PDFDocument's alloc()'s initWithURL:(current application's |NSURL|'s fileURLWithPath:theInputPath)
thePDF's unlockWithPassword:thePassword
thePDF's writeToFile:theOutputPath