Reputation: 2571
I am using iText library to read PDF files. It's working fine for all the pdf files, except for password protected ones. I used some way by using the overloading constructor of PdfReader
class
PdfReader reader = new PdfReader("locked pdf file","password".getBytes());
But it is showing show error like :
Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString
Is there any other to read password protected pdf file? or should I include bouncy castle into my project library?
Upvotes: 2
Views: 13057
Reputation: 109
try {
PdfReader pdfReader = new PdfReader(String.valueOf(file));
pdfReader.isEncrypted();
} catch(IOException) {
e.printStackTrace();
}
Upvotes: 3
Reputation: 9914
Starting from iText 2.0.0 you need the BouncyCastle jars. You need to download it from its site. More info can be found from here:
java.lang.NoClassDefFoundError
Upvotes: 2