PDFParser parser = new PDFParser(is);
parser.parse();
PDDocument document = parser.getPDDocument();
if (document.isEncrypted()) {
DocumentEncryption decryptor = new DocumentEncryption(document);
if (logger.isDebugEnabled()) {
logger.debug("pdf document appears to be encrypted (will attempt decryption)");
}
decryptor.decryptDocument("");
}
file = File.createTempFile("extract", ".tmp");
tempFiles.markForDeletion(file);
Writer output = null;
output = new OutputStreamWriter(new FileOutputStream(file), DEFAULT_ENCODING);