title: Read PDF text and/or all content
body: <p>I have a scenario where I need a Java app to be able to extract content from a PDF file in one of 2 modes: <code>TEXT_ONLY</code> or <code>ALL</code>. In <strong>text mode</strong>, only visible text ("visible" as if a human being was reading the PDF) is read out into strings. In <strong>all mode</strong>, all content (text, images, etc.) is read out of the file.</p>
  
  <p>For instance, if a PDF file was to have 1 page in it, and that page had 3 paragraphs of contiguous text, and was word-wrapping 2 images, then <code>TEXT_ONLY</code> would extract all 3 paragraphs, and <code>ALL</code> would extract all 3 paragraphs and both images:</p>
  
  <pre><code>while(page.hasMoreText())
      textList.add(page.nextTextChunk());
  
  if(allMode)
      while(page.hasMoreImages())
          imageList.add(page.nextImage());
  </code></pre>
  
  <p>I know Apache Tika uses PDFBox under the hood, but am worried that this kind of functionality is shaded/prohibited by Tika (in which case, I probably need to do this directly from PDFBox).</p>
  
  <p>So I ask: <strong>is this possible</strong>, and if so, which library is more appropriate for me to use? Am I going about this entirely the wrong way? Any pitfalls/caveats I am not considering here?</p>