KTScripts
KTScripts copied to clipboard
Issue when page count do not match with sample document
Hello,
Our client has found a problem. They erronously scanned less pages, than the document normally contains. This results in multiple runtime errors, for example when trying to move zones on the page that does not exist.
The examples of my fixes:
Private Sub SL_CalculatePageShift_LocateAlternatives(ByVal pXDoc As CASCADELib.CscXDocument, ByVal pLocator As CASCADELib.CscXDocField)
...
'ZonesExist(AZLDef.Zones(Z).PageNr)=True
If AZLDef.Zones(Z).PageNr <= pXDoc.Pages.Count-1 Then 'TLA
ZonesExist(AZLDef.Zones(Z).PageNr)=True
End If 'TLA
Public Sub Zones_Shift(AZLZones As CscAdvZoneLocZones, Shifts As CscXDocFieldAlternatives, Rep As CscXDocRepresentation)
...
If (AZLZones(Z).PageNr <= Rep.Pages.Count - 1) Then 'TLA
Set XDocZone=Zone_Shift(AZLZones(Z),Shifts,Rep)
Rep.Zones.Append(XDocZone)
End If 'TLA
If I find more issues with this script because of the incorrect number of scanned pages, I'll try to update.
Only further issue was the method for extracting the AZL zones with the already present OCR without doing it again (to save Clarity licences but keep the OCR quality). This of course also failed for locators on non-existent pages. It was enough to add the check.
If SubFields(S).PageIndex > 0 Then