See Also Examples Applies To
Creates a new empty document identifier template.
Then, you will to add images in this template using the ADRAddImageToTemplate() function.
Syntax
object.ADRCreateTemplateEmpty ()
The ADRCreateTemplateEmpty syntax has these parts:
| Part | Description |
| object | Required. An object expression that evaluates to an object in the Applies To list. |
Returns
Long. Return . The created template ID if success else, -1 if fail. check the GetStat() function to get the reason on this result.
Category
Automatic Document Recognition Functions
Visual Basic Sample
How to create document templates and identify the one which have the closer similar content than an image file.
Dim nTemplateID1 As Long, nTemplateID2 As Long
Dim nImageID1 As Long, nImageID2 As Long
Dim nCloserTemplate As Long
'We create the first template from an image
nTemplateID1 = Object.ADRCreateTemplateEmpty
nImageID1 = Object.CreateImageFromFile("template1.tif")
If Object.ADRAddImageToTemplate(nTemplateID1, nImageID1) <> OK Then
MsgBox "Can't add image to nTemplateID1 " + "Error number: " + str(Object.GetStat)
End If
'We create the second template from an other kind of image
nTemplateID2 = Object.ADRCreateTemplateEmpty
nImageID2 = Object.CreateImageFromFile("template2.tif")
If Object.ADRAddImageToTemplate(nTemplateID2, nImageID2) <> OK Then
MsgBox "Can't add image to nTemplateID2 " + "Error number: " + str(Object.GetStat)
End If
'Now, we will try to identify an image.
nCloserTemplate = Object.ADRGetCloserTemplateForFile("document.tif")
Select Case nCloserTemplate
Case nTemplateID1
MsgBox "This image seems to get best similar content as nTemplateID1. Relevance is: " + str(Object.ADRGetLastRelevance) + " %"
Case nTemplateID2
MsgBox "This image seems to get best similar content as nTemplateID2. Relevance is: " + str(Object.ADRGetLastRelevance) + " %"
End Select
'Release created templates from memory
Object.ADRDeleteTemplate (nTemplateID1)
Object.ADRDeleteTemplate (nTemplateID2)