title: How to extract a paragraph from a pdf file and store its position?
body: <p>I'm going to extract the content of a PDF file using PDFBox library. The content should be processed paragraph-by-paragraph and for each paragraph, I need its position for follow-up processing. Using the following code, I can extract the whole content of an input PDF:</p>
  
  <pre><code>PDDocument doc = PDDocument.load(file);
  PDFTextStripper stripper = new PDFTextStripper();
  String txt = stripper.getText(doc);
  doc.close();
  </code></pre>
  
  <p>I have two problems:</p>
  
  <ol>
  <li>I don't know how to extract the content paragraph by paragraph.</li>
  <li>I don't know how to store a position of a paragraph for follow-up processing (for example highlighting and etc.)</li>
  </ol>
  
  <p>Thanks.</p>