Could not find file ‘C:\Windows\TEMP\AquaForestOCR\nnnn_nnn\n_n.hocr’
When using the Aquaforest OCR SDK, intermittently you may receive the following message in your application:
System.IO.FileNotFoundException was caught
Message=Could not find file ‘C:\WINDOWS\TEMP\AquaforestOcr\xxxx_xx\x_x.hocr’.
This message is generated as a direct result of the source file not being OCR’d, however the particular message is not appropriate in this case. In order to resolve this issue you need to subscribe to the StatusUpdate which will allow you to use StatusUpdateEventArgs. This class is available for each page processed when subscribing to the StatusUpdate event and provides information relating to the processing outcome for the page.
Below are the properties of this class.
- int PageNumber This property returns page for which the object relates to.
- int Rotation A value from 0 to 3 which indicates the rotation used for the output in terms of the number of 90° steps away from the orientation in which the input page was provided. If AutoRotation is set to false this will always be 0.
- double ConfidenceScore Generally a value of 1 or greater would indicate that reasonable OCR of a page, but this should be confirmed using “typical” source files.
- bool TextAvailable This property indicates whether text was extracted for the page.
- bool ImageAvailable This property indicates whether an image (after all appropriate pre-processing) was successfully extracted.
- bool BlankPage This property indicates whether the page was detected as blank.
Below is an example in C# where the above class has been used (higlighted in red) to overcome this issue:
static bool textAvailable = false;
static void Main(string args)
Ocr _ocr = new
_ocr.License = “”;
PreProcessor _preProcessor = new PreProcessor();
_ocr.EnableConsoleOutput = true;
string OCRFiles = System.IO.Path.GetFullPath(@”..\..\..\..\..\..\bin”);
System.Environment.SetEnvironmentVariable(“PATH”, System.Environment.GetEnvironmentVariable(“PATH”) + “;”
_ocr.ResourceFolder = OCRFiles;
_preProcessor.Deskew = true;
_preProcessor.Autorotate = false;
_ocr.Language = SupportedLanguages.English;
_ocr.EnablePdfOutput = true;
_ocr.StatusUpdate += OcrStatusUpdate;
string words = null;
for (int j = 1;
j <= _ocr.NumberPages; j++)
words += _ocr.ReadPageString(j);
in OCR Processing :” + e.Message);
private static void OcrStatusUpdate(object sender,
textAvailable = statusUpdateEventArgs.TextAvailable;
Latest posts by Neil Pitman (see all)
- Automated Metadata Tagging for SharePoint and Office 365 - May 17, 2019
- Introducing our Partner, Digital Team - May 14, 2019
- Upgrading Aquaforest Kingfisher - January 14, 2019