Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDFBox 2.0.0 - decryption using password

Tags:

java

pdfbox

I'm trying to unlock a PDF using a password with PDFBox 2.0.0.

In 1.8.11 I was using the PDDocument.openProtection(DecryptionMaterial pm) method but it was removed in 2.0.0 from what I see.

The online documentation does not say how this can be achived in 2.0.0.

Question:

The PDF unlocking with password is still possible in PDFBox 2.0.0?

like image 220
Daddy Pumpkin Avatar asked Dec 24 '22 07:12

Daddy Pumpkin


1 Answers

In 2.0, you just call PDDocument.load(file, password) or PDDocument.load(file) (if the password is empty). You don't have to call openProtection() anymore. The load() of 2.0 call is similar to the loadNonSeq() call of 1.8.

like image 179
Tilman Hausherr Avatar answered Jan 08 '23 11:01

Tilman Hausherr