How to read PDFs created with an unknown random owner password?

后端 未结 1 1759
时光取名叫无心
时光取名叫无心 2020-12-06 11:22

Requirement is to process a batch of PDF\'s one at a time and on success encrypt each of them with an user password.

However, these PDF\'s were encrypted previously

1条回答
  •  爱一瞬间的悲伤
    2020-12-06 12:01

    PdfReader has an undocumented static boolean variable named unethicalreading. For obvious reasons, this variable is set to false by default. You could set this variable to true like this:

    PdfReader.unethicalreading = true;
    

    From now on, PdfReader will ignore the presence of an owner password. It will only throw an exception if a user password is in place.

    Use this at your own risk.

    0 讨论(0)
提交回复
热议问题