Dear experts,
I am having a few difficulties starting with pdfbox. The program does
not seem to find anything in my pdf files. I get this output:
Extract content pdf document leng ----> 0
Here is my code:
public static void main(String[] args){
PDDocument doc = new PDDocument();
try {
doc.load(new File("Shaffer.pdf"));
String docText=null;
try {
PDFTextStripper stripper=new PDFTextStripper();
docText=stripper.getText(doc);
System.out.println("Extract content pdf document length ->
" + docText.length());
}
finally {
if (docText == null) {
logger.info("**************** PDF content is null
*********************");
}
}
doc.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
The program finds the file, and it is definitely a proper pfd with contents.
What am I doing wrong?
Many thanks,
Michel