throw new Parser.Failure("Document is encrypted (2): " + e.getMessage(), location);
} catch (final CryptographyException e) {
try {pdfDoc.close();} catch (final IOException ee) {}
throw new Parser.Failure("Document is encrypted (3): " + e.getMessage(), location);
}
final AccessPermission perm = pdfDoc.getCurrentAccessPermission();
if (perm == null || !perm.canExtractContent())
throw new Parser.Failure("Document is encrypted and cannot be decrypted", location);
}
// extracting some metadata
final PDDocumentInformation info = pdfDoc.getDocumentInformation();