Public Sub ClassLevelReRecognitionCheck(ByVal pXDoc As CASCADELib.CscXDocument)
' Compare the class level profile with the project default.
' If different and exists, delete existing representation and re-execute OCR with class level profile.
Dim oPRP As IMpsPageRecogProfile ' requires reference to Kofax Memphis Forms 4.0
Dim oPR As New MpsPageRecognizing
Dim i As Integer
Dim lDftRecProfileId As Long
Dim lClassRecProfileId As Long
Dim sDftRecProfileName As String
Dim sClassRecProfileName As String
If pXDoc.ExtractionClass <> "" Then
lDftRecProfileId = Project.RecogProfiles.DefaultProfileIdPr
lClassRecProfileId = Project.ClassByName(pXDoc.ExtractionClass).PageRecogProfileId
sDftRecProfileName = CStr(Project.RecogProfiles.ItemByID(lDftRecProfileId).Name)
sClassRecProfileName = CStr(Project.RecogProfiles.ItemByID(lClassRecProfileId).Name)
If sDftRecProfileName <> sClassRecProfileName Then
While pXDoc.Representations.Count > 0
pXDoc.Representations.Remove(0)
Wend
Set oPRP = Project.RecogProfiles.ItemByName(sClassRecProfileName)
For i = 0 To pXDoc.CDoc.Pages.Count -1
oPR.Recognize(pXDoc, oPRP, i)
Next
Else
End If
End If
End Sub