Class TextAnnotation.Builder (2.0.29) 
  
      
     
  
  
  
   
  
    
  
  
    
    
    
  Version 2.0.29keyboard_arrow_down  
  
 
    
    
     
    
    
    
    
    
      
  
  
  
    
public   static   final   class  TextAnnotation . Builder   extends   GeneratedMessageV3 . Builder<TextAnnotation . Builder >  implements   TextAnnotationOrBuilder  
   
   TextAnnotation contains a structured representation of OCR extracted text.
 The hierarchy of an OCR extracted text structure is like this:
     TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
 Each structural component, starting from Page, may further have their own
 properties. Properties describe detected languages, breaks etc.. Please refer
 to the
 TextAnnotation.TextProperty 
 message definition below for more detail.
 Protobuf type google.cloud.vision.v1p4beta1.TextAnnotation
 
  
  
  
  Static Methods
   
   
  getDescriptor() 
  
    
public   static   final   Descriptors . Descriptor   getDescriptor ()  
   
  Returns 
  
  Methods
   
   
  addAllPages(Iterable<? extends Page> values) 
  
    
public   TextAnnotation . Builder   addAllPages ( Iterable <?   extends   Page >  values )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        values  
        Iterable <? extends com.google.cloud.vision.v1p4beta1.Page > 
       
     
  
  Returns 
  
   
  addPages(Page value) 
  
    
public   TextAnnotation . Builder   addPages ( Page   value )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        value  
        Page  
       
     
  
  Returns 
  
   
  addPages(Page.Builder builderForValue) 
  
    
public   TextAnnotation . Builder   addPages ( Page . Builder   builderForValue )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
  Returns 
  
   
  addPages(int index, Page value) 
  
    
public   TextAnnotation . Builder   addPages ( int   index ,   Page   value )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameters 
  
    
      
        Name  
        Description  
       
      
        index  
        int  
       
      
        value  
        Page  
       
     
  
  Returns 
  
   
  addPages(int index, Page.Builder builderForValue) 
  
    
public   TextAnnotation . Builder   addPages ( int   index ,   Page . Builder   builderForValue )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameters 
  
  Returns 
  
   
  addPagesBuilder() 
  
    
public   Page . Builder   addPagesBuilder ()  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Returns 
  
   
  addPagesBuilder(int index) 
  
    
public   Page . Builder   addPagesBuilder ( int   index )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        index  
        int  
       
     
  
  Returns 
  
   
  addRepeatedField(Descriptors.FieldDescriptor field, Object value) 
  
    
public   TextAnnotation . Builder   addRepeatedField ( Descriptors . FieldDescriptor   field ,   Object   value )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
   
  build() 
  
    
public   TextAnnotation   build ()  
   
  Returns 
  
   
  buildPartial() 
  
    
public   TextAnnotation   buildPartial ()  
   
  Returns 
  
   
  clear() 
  
    
public   TextAnnotation . Builder   clear ()  
   
  Returns 
  
  Overrides 
  
   
  clearField(Descriptors.FieldDescriptor field) 
  
    
public   TextAnnotation . Builder   clearField ( Descriptors . FieldDescriptor   field )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  clearOneof(Descriptors.OneofDescriptor oneof) 
  
    
public   TextAnnotation . Builder   clearOneof ( Descriptors . OneofDescriptor   oneof )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  clearPages() 
  
    
public   TextAnnotation . Builder   clearPages ()  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Returns 
  
   
  clearText() 
  
    
public   TextAnnotation . Builder   clearText ()  
   
   UTF-8 text detected on the pages.
 string text = 2;
 
  Returns 
  
   
  clone() 
  
    
public   TextAnnotation . Builder   clone ()  
   
  Returns 
  
  Overrides 
  
   
  getDefaultInstanceForType() 
  
    
public   TextAnnotation   getDefaultInstanceForType ()  
   
  Returns 
  
   
  getDescriptorForType() 
  
    
public   Descriptors . Descriptor   getDescriptorForType ()  
   
  Returns 
  
  Overrides 
  
   
  getPages(int index) 
  
    
public   Page   getPages ( int   index )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        index  
        int  
       
     
  
  Returns 
  
   
  getPagesBuilder(int index) 
  
    
public   Page . Builder   getPagesBuilder ( int   index )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        index  
        int  
       
     
  
  Returns 
  
   
  getPagesBuilderList() 
  
    
public   List<Page . Builder >  getPagesBuilderList ()  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Returns 
  
   
  getPagesCount() 
  
    
public   int   getPagesCount ()  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Returns 
  
   
  getPagesList() 
  
    
public   List<Page>   getPagesList ()  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Returns 
  
   
  getPagesOrBuilder(int index) 
  
    
public   PageOrBuilder   getPagesOrBuilder ( int   index )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        index  
        int  
       
     
  
  Returns 
  
   
  getPagesOrBuilderList() 
  
    
public   List <?   extends   PageOrBuilder >  getPagesOrBuilderList ()  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Returns 
  
    
      
        Type  
        Description  
       
      
        List <? extends com.google.cloud.vision.v1p4beta1.PageOrBuilder > 
         
       
     
  
   
  getText() 
  
   UTF-8 text detected on the pages.
 string text = 2;
 
  Returns 
  
    
      
        Type  
        Description  
       
      
        String  
        The text.
 
       
     
  
   
  getTextBytes() 
  
    
public   ByteString   getTextBytes ()  
   
   UTF-8 text detected on the pages.
 string text = 2;
 
  Returns 
  
   
  internalGetFieldAccessorTable() 
  
    
protected   GeneratedMessageV3 . FieldAccessorTable   internalGetFieldAccessorTable ()  
   
  Returns 
  
  Overrides 
  
   
  isInitialized() 
  
    
public   final   boolean   isInitialized ()  
   
  Returns 
  
  Overrides 
  
   
  mergeFrom(TextAnnotation other) 
  
    
public   TextAnnotation . Builder   mergeFrom ( TextAnnotation   other )  
   
  Parameter 
  
  Returns 
  
   
  mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) 
  
    
public   TextAnnotation . Builder   mergeFrom ( CodedInputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
  Exceptions 
  
   
  mergeFrom(Message other) 
  
    
public   TextAnnotation . Builder   mergeFrom ( Message   other )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  mergeUnknownFields(UnknownFieldSet unknownFields) 
  
    
public   final   TextAnnotation . Builder   mergeUnknownFields ( UnknownFieldSet   unknownFields )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  removePages(int index) 
  
    
public   TextAnnotation . Builder   removePages ( int   index )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        index  
        int  
       
     
  
  Returns 
  
   
  setField(Descriptors.FieldDescriptor field, Object value) 
  
    
public   TextAnnotation . Builder   setField ( Descriptors . FieldDescriptor   field ,   Object   value )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
   
  setPages(int index, Page value) 
  
    
public   TextAnnotation . Builder   setPages ( int   index ,   Page   value )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameters 
  
    
      
        Name  
        Description  
       
      
        index  
        int  
       
      
        value  
        Page  
       
     
  
  Returns 
  
   
  setPages(int index, Page.Builder builderForValue) 
  
    
public   TextAnnotation . Builder   setPages ( int   index ,   Page . Builder   builderForValue )  
   
   List of pages detected by OCR.
 repeated .google.cloud.vision.v1p4beta1.Page pages = 1;
 
  Parameters 
  
  Returns 
  
   
  setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value) 
  
    
public   TextAnnotation . Builder   setRepeatedField ( Descriptors . FieldDescriptor   field ,   int   index ,   Object   value )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
   
  setText(String value) 
  
    
public   TextAnnotation . Builder   setText ( String   value )  
   
   UTF-8 text detected on the pages.
 string text = 2;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        value  
        String The text to set.
 
       
     
  
  Returns 
  
   
  setTextBytes(ByteString value) 
  
    
public   TextAnnotation . Builder   setTextBytes ( ByteString   value )  
   
   UTF-8 text detected on the pages.
 string text = 2;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        value  
        ByteString The bytes for text to set.
 
       
     
  
  Returns 
  
   
  setUnknownFields(UnknownFieldSet unknownFields) 
  
    
public   final   TextAnnotation . Builder   setUnknownFields ( UnknownFieldSet   unknownFields )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
 
     
    
  
  
  
     
  
 
  
    
    
      
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-30 UTC.
 
 
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-30 UTC."],[],[]]