### Perform OCR and Extract Text with Position Source: https://github.com/eiceblue/spire.ocr-for-python/blob/main/PythonExample/ocr_python.md Scans an image file using Spire.OCR, extracts the text, and iterates through text blocks to get their content and bounding box positions. ```Python from spire.ocr import OcrScanner, ConfigureOptions # Create OCR scanner scanner = OcrScanner() # Configure scanner options configureOptions = ConfigureOptions() configureOptions.ModelPath = r"D:\OCR\win-x64" configureOptions.Language = "English" scanner.ConfigureDependencies(configureOptions) # Scan image file scanner.Scan(r"Data\Sample.png") # Extract text and block information text = scanner.Text.ToString() + "\n" for block in scanner.Text.Blocks: rectangle = block.Box postions = f"{block.Text} -> x : {rectangle.X} , y : {rectangle.Y} , w : {rectangle.Width} , h : {rectangle.Height}" text += postions + "\n" ``` -------------------------------- ### OCR Image Stream Processing Source: https://github.com/eiceblue/spire.ocr-for-python/blob/main/PythonExample/ocr_python.md Performs OCR on an image provided as a stream using Spire.OCR, configuring the scanner with a specified model path and language. ```Python from spire.ocr import OcrScanner, ConfigureOptions, OCRImageFormat from spire.ocr.utils import Stream # Create OCR scanner scanner = OcrScanner() configureOptions = ConfigureOptions() # Set OCR configuration configureOptions.ModelPath = r"D:\OCR\win-x64" configureOptions.Language = "Japan" scanner.ConfigureDependencies(configureOptions) # Create image stream and set format image_stream = Stream(r"Data\JapaneseSample.png") image_format = OCRImageFormat.Png # Scan image and extract text scanner.Scan(image_stream, image_format) text = scanner.Text.ToString() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.