pdf = parser.getPDDocument();
if (pdf.isEncrypted()) {
//Just try using the default password and move on
pdf.openProtection(new StandardDecryptionMaterial(""));
}
// collect text
PDFTextStripper stripper = new PDFTextStripper();
text = stripper.getText(pdf);