Class DocumentOcrResultSet

java.lang.Object
com.google.cloud.spring.vision.DocumentOcrResultSet

public class DocumentOcrResultSet extends Object
Represents the parsed OCR content for an document in the provided range of pages.
  • Method Summary

    Modifier and Type
    Method
    Description
    Iterator<com.google.cloud.vision.v1.TextAnnotation>
    Returns an Iterator over all the OCR pages of the document.
    int
    Returns the maximum page number in the result set.
    int
    Returns the minimum page number in the result set.
    com.google.cloud.vision.v1.TextAnnotation
    getPage(int pageNumber)
    Retrieves the parsed OCR information of the page at index pageNumber of the document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getMinPage

      public int getMinPage()
      Returns the minimum page number in the result set.
      Returns:
      the lowest page number in the result set.
    • getMaxPage

      public int getMaxPage()
      Returns the maximum page number in the result set.
      Returns:
      the highest page number in the result set.
    • getPage

      public com.google.cloud.vision.v1.TextAnnotation getPage(int pageNumber) throws com.google.protobuf.InvalidProtocolBufferException
      Retrieves the parsed OCR information of the page at index pageNumber of the document. The page number must be a value between getMinPage() and getMaxPage().

      This returns a TextAnnotation object which is Google Cloud Vision's representation of a page of a document. For more information on reading this object, see: https://cloud.google.com/vision/docs/reference/rpc/google.cloud.vision.v1#google.cloud.vision.v1.TextAnnotation

      Parameters:
      pageNumber - the page number of the document
      Returns:
      the TextAnnotation representing the page of the document
      Throws:
      com.google.protobuf.InvalidProtocolBufferException - if the OCR information for the page failed to be parsed
    • getAllPages

      public Iterator<com.google.cloud.vision.v1.TextAnnotation> getAllPages()
      Returns an Iterator over all the OCR pages of the document.
      Returns:
      iterator of TextAnnotation describing OCR content of each page in the document.