Hi Team,
Below code throw error for any tiff file. I wanted to clear processing filter for some reason. It throw exception.
Sample code
RecognitionSettings drsMultiplePage = new()
{
UpscaleSmallFont = true,
Language = Language.Eng,
DetectAreasMode = DetectAreasMode.TABLE,
LinesFiltration = false,
ThreadsCount = 0
};
Aspose.OCR.Logging.Console = true; Aspose.OCR.Logging.FileSystem = true; Aspose.OCR.Logging.LogFilePath = "recognition.log"; Aspose.OCR.Logging.LoggingLevel = LoggingLevel.Debug;
Resources.AllowAutomaticDownloads(true);
AsposeOcr api = new AsposeOcr();
License lic = new License();
Aspose.Imaging.License ImgLic = new();
ImgLic.SetLicense("Aspose.Total.NET.lic");
lic.SetLicense("Aspose.Total.NET.lic"); Console.WriteLine("License " + lic.IsLicensed);
string Filename = Path.GetFileName(imgPath);
PreprocessingFilter pp = new PreprocessingFilter
{
Aspose.OCR.Models.PreprocessingFilters.PreprocessingFilter.Empty
};
int pgcount = 0;
OcrInput ocrInput = new OcrInput(InputType.TIFF, pp);
ocrInput.Add(imgPath);
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
List<Aspose.OCR.SkewOutput> skewOutputs = api.CalculateSkew(ocrInput);
stopwatch.Stop();
Console.WriteLine(" Started " + imgPath + " Pages :" + pgcount + " Skew wait: " + stopwatch.Elapsed + " skewAngle " + skewOutputs[0].Angle);
stopwatch.Restart();
List<RecognitionResult> result = new List<RecognitionResult>();
for (int i = 1; i <= 1; i++)
{
stopwatch.Start();
if (i == 1) drsMultiplePage.DetectAreasMode = DetectAreasMode.PHOTO;
if (i == 2) drsMultiplePage.DetectAreasMode = DetectAreasMode.PHOTO;
result = api.Recognize(ocrInput, drsMultiplePage);
stopwatch.Stop();
Console.WriteLine(drsMultiplePage.DetectAreasMode.ToString() + " Time:" + stopwatch.Elapsed.ToString() + "Pages" + pgcount);
CompleteResult Source = new CompleteResult();
stopwatch.Restart();
string outputpath = Path.GetFullPath(imgPath) + "_searchable_" + drsMultiplePage.DetectAreasMode.ToString() + "_NEW32.pdf";
AsposeOcr.SaveMultipageDocument(outputpath, Aspose.OCR.SaveFormat.Pdf, result);
stopwatch.Stop();
}
EmptyFilterErrror.PNG (25.1 KB)