title: Java: Apache PDFbox Extract highlighted text
body: <p>I am using Apache PDFbox library to extract the the highlighted text (i.e., with yellow background) from a PDF file. I am totally new to this library and don't know which class from it to be used for this purpose.
  So far I have done extraction of text from comments using below code.</p>
  
  <pre><code>PDDocument pddDocument = PDDocument.load(new File("test.pdf"));
      List allPages = pddDocument.getDocumentCatalog().getAllPages();
      for (int i = 0; i &lt; allPages.size(); i++) {
      int pageNum = i + 1;
      PDPage page = (PDPage) allPages.get(i);
      List&lt;PDAnnotation&gt; la = page.getAnnotations();
      if (la.size() &lt; 1) {
      continue;
      }
      System.out.println("Total annotations = " + la.size());
      System.out.println("\nProcess Page " + pageNum + "...");
      // Just get the first annotation for testing
      PDAnnotation pdfAnnot = la.get(0); 
      System.out.println("Getting text from comment = " + pdfAnnot.getContents());
  </code></pre>
  
  <p>Now I need to get the highlighted text, any code example will be highly appreciated.</p>