accessing password attribute of pdf using VB/VBA
Hello,
I was working on an interesting project for a client of mine and I came across an interesting problem I was hoping someone could help me with? I was scanning through thousands of pdfs for some information and extracting this to Excel for processing. I used the acrobat library to work with the pdf data. The problem I was having was that when the program encountered a password protected pdf, it would bug out until the cancel button was pressed. I couldn't find anything in the library documentation on how to handle password protected pdfs so I used window api to click the cancel button. A direct side effect of this is that I am unable to do anything on the machine whilst the program is running as the windows api would activate the acrobat window.When not opening the pdf to look for the password button (and not using the windows api) I didn't have this issue as it was doing all the reading and copying text in the background.
My question is this: is there a way to find out whether a pdf is password protected using the pdf attribute information? If so, how can this be done? This would solve all my issues for next time 🙂
Thanks!
