Package com.google.cloud.spring.vision
Class DocumentOcrResultSet
java.lang.Object
com.google.cloud.spring.vision.DocumentOcrResultSet
Represents the parsed OCR content for an document in the provided range of pages.
-
Method Summary
Modifier and TypeMethodDescriptionIterator<com.google.cloud.vision.v1.TextAnnotation>
Returns anIterator
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 indexpageNumber
of the document.
-
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 indexpageNumber
of the document. The page number must be a value betweengetMinPage()
andgetMaxPage()
.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
Returns anIterator
over all the OCR pages of the document.- Returns:
- iterator of
TextAnnotation
describing OCR content of each page in the document.
-