<?php

namespace App\Services\FileTools\OCR;
use thiagoalessio\TesseractOCR\TesseractOCR;

class TesseractImageOCR implements IImageOCR
{
    /**
     * @inheritDoc
     */
    public function performOCR(string $filePath): string {
        try {
            $tesseract = new TesseractOCR($filePath);
            return $tesseract->run();
        } catch (\Exception $e) {
            // Handle the exception, log it, or rethrow it as needed
            // For now, we just return an empty string
            return '';
        }
    }
}
