pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michel de Lange <michel_de_la...@yahoo.co.uk>
Subject newbie question
Date Sat, 25 Apr 2015 02:25:26 GMT
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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message