Permanently decrypting PDFs?

Some organisations (like banks) tend to send encrypted PDFs. Decrypting these PDFs to store/index in DEVONthink is a multi-step process:

  • First import the encrypted PDF
  • Open it, and type in the encryption key/password
  • Click “File → Export as PDF…” to save an unencrypted version on the Desktop (or somewhere else)
  • Import the new, unencrypted copy
  • Delete the encrypted copy

Is there any way to shorten this workflow? It would be great if I could somehow just click a single button to decrypt a PDF (followed by typing in the key, of course).

This simple script can at least replace the last 3 steps and therefore expects that a decrypted PDF document is visible in the frontmost window.

tell application id "DNtp"
	set theWindow to think window 1
	set theRecord to content record of theWindow
	if type of theRecord is PDF document then
		set thePDF to paginated PDF of theWindow
		set data of theRecord to thePDF
	end if
end tell
1 Like

Yikes, thanks you! :flushed:

That is incredibly useful!