Code: Select all
Function GetOrientation(strFile As String, Optional varAccLevel As Variant) As RotateFlipType
Dim gdImgObj As New GdPicture_NET.GdPictureImaging
Dim Dict As GdPicture_NET.TesseractDictionary
Dim lngPDFHandle, lngPDFId_O As Long
Dim strADInfo, strSubject, strTitle As String
Dim bolPDFA, bolDone As Boolean
Dim intPage, intImgID As Integer
Dim sngAccLevel As Single
On Error GoTo Err_GetOrientation
bolPDFA = True
sngAccLevel = IIf(IsMissing(varAccLevel), 3, CSng(varAccLevel))
gdImgObj.SetLicenseNumber ("XXX")
Dict = GdPicture_NET.TesseractDictionary_TesseractDictionaryEnglish
lngPDFHandle = gdImgObj.PdfReaderLoadFromFile(strFile)
If lngPDFHandle <> 0 Then
intImgID = gdImgObj.PdfReaderRenderPageToGdPictureImage(lngPDFHandle, 200, True)
If intImgID <> 0 Then
GetOrientation = gdImgObj.OCRTesseractGetOrientation(intImgID, Dict, _
GetDMDefault("Dictionary", Left(CurrentInstall(), 1)))
End If
End If
Exit_GetOrientation:
Exit Function
Err_GetOrientation:
Select Case Err
Case Else
LogError "GetOrientation", "modSearch", Err, "VBA"
'MsgBox Err.Description, vbOKOnly + vbCritical, "Error - GetOrientation"
Resume Exit_GetOrientation
End Select
End Function
Please explain why this is happening and what I might do to make GDImgObj.PdfReaderLoadFromFile(strFile) return the necessary file handle. I am using GDPicture.NET V 7.2.0.1
Thanks,
DT