Improve bar code recognition
The FineReader MinRatioToTextHeightBarcode property defines the minimum height for a bar code in relation to the average letter height on a document. Defining this property is helpful when detecting small bar codes.
The default value for this setting is 0.5, but if this is not sufficient, you can modify this value.
The MinRatioToTextHeightBarcode property is exposed in CscBarcodeLocator and the range for this property is between 0.1 and 2.0.
If the value set in script is outside of this range, the value is limited. Values below 0.1 are changed to 0.1 and values above 2.0 are lowered to 2.0. If the value is set to -1, this means that FineReader uses automatic mode to detect bar codes.
In order to configure this property, add an additional reference for the Bar Code Locator to the script sheet you are using. You can set this property in the Before_Extract event as shown in the following example.
' Class script: MyClassName
Private Sub Document_BeforeExtract(ByVal pXDoc As CASCADELib.CscXDocument)
Dim oClass As CscClass
Dim oLocDef As CscLocatorDef
Dim oBarcodeLocator As CscBarcodeLocator
Set oClass = Project.ClassByName("MyClassName")
Set oLocDef = oClass.Locators.ItemByName("MyBarcodeLocator")
Set oBarcodeLocator = oLocDef.LocatorMethod
oBarcodeLocator.MinRatioToTextHeightBarcode = 0.1
End Sub