title: Advanced PDF parser for Java
body: <p>I want to extract different content from a PDF file in Java:</p>
  
  <ul>
  <li>The complete visible text</li>
  <li>images</li>
  <li>links</li>
  </ul>
  
  <p>Is it also possible to get the following?</p>
  
  <ul>
  <li>document meta tags like title, description or author</li>
  <li>only headlines</li>
  <li>input elements if the document contains a form</li>
  </ul>
  
  <p>I do not need to manipulate or render PDF files. Which library would be the best fit for that kind of purpose?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>OK, I tried PDFBox:</p>
  
  <pre><code>Document luceneDocument = LucenePDFDocument.getDocument(new File(path));
  Field contents = luceneDocument.getField("contents");
  System.out.println(contents.stringValue());
  </code></pre>
  
  <p>But the output is null. The field "summary" is OK though.</p>
  
  <p>The next snippet works fine.</p>
  
  <pre><code>PDDocument doc = PDDocument.load(path);
  PDFTextStripper stripper = new PDFTextStripper();
  String text = stripper.getText(doc);
  System.out.println(text);
  doc.close();
  </code></pre>
  
  <p>But then, I have no clue how to extract the images, links, etc.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>I found an example how to extract the images, but I still got no answer on how to extract:</p>
  
  <ul>
  <li>links</li>
  <li>document meta tags like title, description or author</li>
  <li>only headlines</li>
  <li>input elements if the document contains a form</li>
  </ul>