Question

I have a VBScript script that looks like this:

Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\OCRresults.txt", ForAppending, True)
set miDoc=CreateObject("MODI.Document")
miDoc.Create ("C:\PathToTifScreenshot.tif")
miDoc.Images(0).OCR
set miLayout = miDoc.Images(0).Layout
stringOut=miLayout.Text
objTextFile.WriteLine stringOut
DoOCR = stringOut
Set miLayout = Nothing
Set miDoc = Nothing
Set objFSO = Nothing

It uses MODI to OCR a tif file. However, MODI automatically identifies rotated images and I do not want it to work this way. What I basically want is for it to OCR properly only when the image is properly rotated. There is an option in the gui of MODI that you can uncheck: "Auto Rotate", but it seems that this only works for the manual process. Any ideas how I can prevent my script from identifying rotated images?

Was it helpful?

Solution

The MODI's OCR method has three parameters:

expression.OCR(LangId, OCROrientImage, OCRStraightenImage)

The description for the 2nd parameter, OCROrientImage, states:

OCROrientImage Optional Boolean. Specifies whether the OCR engine attempts to determine the orientation of the page. Default is true.

Try setting this parameter to False and see if it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top