Indicates if this character is part of a right-to-left flow of text.
public bool IsRightToLeft {get; set;} public:property bool IsRightToLeft{bool get()void set(bool value)}
public boolean isRightToLeft()public void setRightToLeft(boolean value)
IsRightToLeft # get and set (DocumentCharacter)
true if this character is part of a right-to-left flow of text; otherwise, false.
Set this value to true if this part of the text flow should be right-to-left (for example, Arabic or Hebrew text).
using Leadtools;using Leadtools.Codecs;using Leadtools.Document.Writer;using Leadtools.Document;using Leadtools.Caching;using Leadtools.Annotations.Engine;using Leadtools.Ocr;using Leadtools.Barcode;using Leadtools.Document.Converter;public void StoreOcrPageCharactersExample(){// Initialize an OCR engineIOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD);// Start the engine using default parametersocrEngine.Startup(null, null, null, @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime");// Load a document that we know will be OCRedstring documentFile = @"C:\LEADTOOLS22\Resources\Images\ocr1.tif";using (LEADDocument document = DocumentFactory.LoadFromFile(documentFile, new LoadDocumentOptions())){// Set the OCR enginedocument.Text.OcrEngine = ocrEngine;// First, do not store IOcrPageCharacters in DocumentPageText, this will// cause our code to extract the character OCR confidences value to not workdocument.Text.StoreOcrPageCharacters = false;Console.WriteLine("Obtaining OCR characters confidence with StoreOcrPageCharacters equals to false. Should fail");// Now get the textDocumentPage documentPage = document.Pages[0];DocumentPageText documentPageText = documentPage.GetText();// Build the wordsdocumentPageText.BuildWords();ShowOcrConfidence(documentPageText);Console.WriteLine("Obtaining OCR characters confidence with StoreOcrPageCharacters equals to true. Should work");document.Text.StoreOcrPageCharacters = true;documentPageText = documentPage.GetText();// Build the wordsdocumentPageText.BuildWords();ShowOcrConfidence(documentPageText);}ocrEngine.Dispose();}private static void ShowOcrConfidence(DocumentPageText documentPageText){Console.WriteLine("Showing OCR confidence value of the characters of the first word");if (documentPageText.Words == null){Console.WriteLine("Nothing to show");return;}// Show the OCR character confidence for the first word// Get the first wordDocumentWord word = documentPageText.Words[0];Console.WriteLine($"first word value:{word.Value}");// Get its charactersfor (int characterIndex = word.FirstCharacterIndex; characterIndex <= word.LastCharacterIndex; characterIndex++){// DocumentCharacter referenceDocumentCharacter documentCharacter = documentPageText.Characters[characterIndex];Console.WriteLine($" character at index {characterIndex} is {documentCharacter.Code} its isFromOcr value is {documentCharacter.IsFromOcr} and its bounds are {documentCharacter.Bounds}");Console.WriteLine($"Is end of line: {documentCharacter.IsEndOfLine}");Console.WriteLine($"Is end of word: {documentCharacter.IsEndOfWord}");Console.WriteLine($"Is right to left: {documentCharacter.IsRightToLeft}");// Ensure this is a character obtained from OCRif (documentCharacter.IsFromOcr){// See if we stored the IOcrPageCharacters inif (documentPageText.OcrPageCharacters != null){// We have it, get the corresponding OcrCharcater// Get the zone charactersIOcrZoneCharacters ocrZoneCharacters = documentPageText.OcrPageCharacters[documentCharacter.OcrZoneIndex];// And the character in this zoneOcrCharacter ocrCharacter = ocrZoneCharacters[documentCharacter.OcrCharacterIndex];int confidence = ocrCharacter.Confidence;Console.WriteLine($" OCR character code is {ocrCharacter.Code} and confidence is {confidence}");// Sanity checkDebug.Assert(ocrCharacter.Code == documentCharacter.Code);}else{Console.WriteLine(" Failed to get OCR confidence");}}}}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
