I have got a byte array of a pdf file and want to get the text out of the file. My code below works, but I need to create an actual file first. Do you know a better way, so I don't have to create this file first?
try {
File temp = File.createTempFile("temp-pdf", ".tmp");
OutputStream out = new FileOutputStream(temp);
out.write(Base64.decodeBase64(testObject.getPdfAsDoc().getContent()));
out.close();
PDDocument document = PDDocument.load(temp);
PDFTextStripper pdfStripper = new PDFTextStripper();
String text = pdfStripper.getText(document);
log.info(text);
} catch(IOException e){
}