OCR.GetTextWithCoordinates
--------------------------

Queries text with coordinates.

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

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

none

### Result

Returns list or error.

### Description

Queries text with coordinates.  
Please call [OCR.Recognize](OCRRecognize.md) or [OCR.GetText](OCRGetText.md) or another function first to trigger recognition.  
  
Returns a list with tab separated values. First 4 values define the pixel coordinates. Then followed by style and font size. Finally the word.  
  
Columns: left, top, right, bottom, isBold, isItalic, isUnderlined, isMonospace, isSerif, isSmallCaps, Pointsize, Text.  
  
e.g.  
| left | top | right | bottom | isBold | isItalic | isUnderlined | isMonospace | isSerif | isSmallCaps | Pointsize | Text |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 36 | 194 | 91 | 218 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | The |
| 102 | 194 | 177 | 224 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | quick |
| 189 | 194 | 274 | 218 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | brown |
| 287 | 194 | 339 | 225 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | dog |
| 348 | 194 | 456 | 225 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | jumped |
| 468 | 200 | 531 | 218 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | over |
| 540 | 194 | 585 | 218 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | the |
| 37 | 228 | 92 | 259 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | lazy |
| 103 | 228 | 153 | 252 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | fox. |

  
See [OCR.GetTextAsJSON](OCRGetTextAsJSON.md) function for new development.  
### Examples

Recognize:

 #Init OCR   
Set Variable \[$r ; Value:MBS ( "[OCR.Initialize](OCRInitialize.md)"; "/Users/cs/Documents"; "eng")\]  
Set Variable \[$rr ; Value:MBS ( "[OCR.SetPageSegMode](OCRSetPageSegMode.md)"; "Auto")\]  
\#Process Image   
Set Variable \[$img ; Value:MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; OCR::Image )\]  
Set Variable \[$r ; Value:MBS ( "[OCR.SetImage](OCRSetImage.md)"; $img )\]  
Set Variable \[$rr ; Value:MBS ( "[OCR.Recognize](OCRRecognize.md)")\]  
Set Field \[OCR::Text ; MBS ("OCR.GetTextWithCoordinates")\]  
\#Cleanup   
Set Variable \[$r ; Value:MBS ( "[OCR.Cleanup](OCRCleanup.md)")\]  
Set Variable \[$r ; Value: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.GetText](OCRGetText.md)
- [OCR.GetTextAsJSON](OCRGetTextAsJSON.md)
- [OCR.Initialize](OCRInitialize.md)
- [OCR.Recognize](OCRRecognize.md)
- [OCR.SetImage](OCRSetImage.md)
- [OCR.SetPageSegMode](OCRSetPageSegMode.md)

This function is free to use.

Created 30th September 2016 , last changed 25th May 2023

  
[OCR.GetTextAsJSON](OCRGetTextAsJSON.md) - [OCR.GetVariable](OCRGetVariable.md)

[HTML Version](OCRGetTextWithCoordinates.shtml)