import java.io.FileInputStream;
import org.apache.pdfbox.cos.COSDocument;
import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.PDFTextStripper;
public class Read {
 public String readFdf(String file) {
  String docText = "";
  try {
   FileInputStream fis = new FileInputStream(file);
   COSDocument cosDoc = null;
   PDFParser parser = new PDFParser(fis);
   parser.parse();
   cosDoc = parser.getDocument();
   PDFTextStripper stripper = new PDFTextStripper();
   docText = stripper.getText(new PDDocument(cosDoc));
   System.out.println(docText);
  } catch (Exception e) {
   System.out.println("bb=" + e.getMessage());
  }
  return docText;
 }
 public static void main(String args[]) {
  Read read = new Read();
  String s = read.readFdf("G:\\apdf\\test.pdf");
  System.out.println(s);
 }
}

 只需要一个jar包即可 pdfbox-app-1.8.7.jar

jar包下载地址 http://pdfbox.apache.org/ 

参考博客:http://wangbaoaiboy.blog.163.com/blog/static/521119102010111613126524/

这里边的连个包都包括在 pdfbox-app-1.8.7.jar里了,不需要重新引入