OCR.GetText
-----------

Returns recognized text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [OCR](component_OCR.md) | [2.9](newinversion29.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "OCR.GetText" ) ### Parameters

none

### Result

Returns the text.

### Description

Returns recognized text.  
Calls Recognize if needed internally.  
  
We intent to remove tesseract 3.x library from the plugin in summer 2022, so please move to loading the newer version using [OCR.Load](OCRLoad.md) function.  
### Examples

Query text:

 $text = MBS ( "OCR.GetText" )  
Custom function to read image and return text:

 Let (   
/\*  
MBS -OCR ( language; Image)  
  
Requires tessdata resources \[MIT ©\]  
language: deu ('deu.traineddata), fra, eng, etc.  
Image: Container Fieldname ('MyTable::MyField ') in Quotes  
path: FM/Extensions - put 'tessdata' Folder into FM Extensions Folder  
  
Benjamin Fehr, EfficientBizz GmbH  
http://www.efficientbizz.com   
\*/  
  
\[  
  
// init OCR  
 $path = MBS ("[Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)"; Get(FileMakerPath)&amp; "Extensions/") ;  
 initialize = MBS ( "[OCR.Initialize](OCRInitialize.md)"; $path ; language) ; $Error = initialize ;   
 SegMode = MBS ( "[OCR.SetPageSegMode](OCRSetPageSegMode.md)"; "Auto");  
  
// Process Image  
 $img = MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; Image);  
 set = MBS ("[OCR.SetImage](OCRSetImage.md)"; $img ) ;  
 $result = MBS ("OCR.GetText") ;  
  
  
// Cleanup  
 $clean = MBS ( "[OCR.Cleanup](OCRCleanup.md)") ;   
 $destroy = MBS ( "[GMImage.Release](GMImageRelease.md)"; $img )   
  
  
\]   
; "" )  
### See also

- [GMImage.New](GMImageNew.md)
- [GMImage.NewFromContainer](GMImageNewFromContainer.md)
- [GMImage.Release](GMImageRelease.md)
- [OCR.Cleanup](OCRCleanup.md)
- [OCR.GetBoxText](OCRGetBoxText.md)
- [OCR.GetTextWithCoordinates](OCRGetTextWithCoordinates.md)
- [OCR.Initialize](OCRInitialize.md)
- [OCR.SetImage](OCRSetImage.md)
- [OCR.SetPageSegMode](OCRSetPageSegMode.md)
- [WindowsOCR.Result](WindowsOCRResult.md)

### Release notes

- **Version 13.3**
    - Added [OCR.GetTextAsJSON](https://www.mbsplugins.eu/OCRGetTextAsJSON.shtml) function.

### Example Databases

- [OCR/OCR with DynaPDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/OCR/OCR%20with%20DynaPDF.shtml#1ScriptAnchor_)

This function is free to use.

Created 18th August 2014 , last changed 24th February 2026

  
[OCR.GetPageSegMode](OCRGetPageSegMode.md) - [OCR.GetTextAsJSON](OCRGetTextAsJSON.md)

[HTML Version](OCRGetText.shtml)