The customer has come in contact with some password-protected PDFs from
As my application copies data from PDFs such as these into one big
compilation, we have encountered a problem here. Today, the copied
pages are simply blank.
My question to you is if there is some technology in PDF.Net I can use
to copy the contents of password-protected documents?
Yes, you can open password protected files as illustrated in 'EncTest'
You can either derive a new class from StdSecurityHandler or you can
provide the password directly in pdfdoc.SetStdSecHandler(...). Please
keep in mind that you should call pdfdoc.SetSecHandler() even if the
file is not password protected (just in case it is encrypted without a
So, to summarize:
To open a semi-locked PDF without a password, just call
pdfdoc.InitSecurityHandler() just after opening the document. For
documents that require 'open' password in Acrobat, you will need to
provide the password in order to open the document (e.g using
pdfdoc.InitStdSecurityHandler() or as illustrated in EncTest sample