I attach the project I used to test this. The most important part of code is below:
Code: Select all
var files = Directory.GetFiles(txtInputFile.Text);
foreach (var file in files)
{
using (var pdf = new GdPicturePDF())
{
pdf.LoadFromFile(file);
if (pdf.OcrPages("*", 0, "eng", txtDictsPath.Text, string.Empty, 300, OCRMode.FavorAccuracy, 30000, true) != GdPictureStatus.OK)
{
throw new Exception("Ocr failed");
}
pdf.ClearCachedResources();
pdf.CloseDocument();
GdPictureDocumentUtilities.ForceGarbageCollection();
}
}
Am I doing something wrong? Is it bug in library? Is it intended behaviour?