I have the next example code:
Code: Select all
Dim oGdPictureImaging As New GdPicture9.GdPictureImaging
oGdPictureImaging.SetLicenseNumber("license demo") 'Replace XXXX by a valid or commercial KEY
oGdPictureImaging.SetLicenseNumberOCRTesseract("license demo") 'Replace XXXX by a valid or commercial KEY
Dim sOCR As String
Dim hFile As Integer
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("")
Dim PageCount As Integer = 1
If oGdPictureImaging.GetStat = GdPictureStatus.OK Then
If oGdPictureImaging.TiffIsMultiPage(ImageID) Then
PageCount = oGdPictureImaging.TiffGetPageCount(ImageID)
End If
If Dir(My.Application.Info.DirectoryPath & "\ocr.txt") <> "" Then Kill((My.Application.Info.DirectoryPath & "\ocr.txt"))
hFile = FreeFile()
FileOpen(hFile, My.Application.Info.DirectoryPath & "\ocr.txt", OpenMode.Append)
For I As Integer = 1 To PageCount
If I > 1 Then
oGdPictureImaging.TiffSelectPage(ImageID, I)
End If
oGdPictureImaging.OCRTesseractReinit()
sOCR = oGdPictureImaging.OCRTesseractDoOCR(ImageID, TesseractDictionary.TesseractDictionaryEnglish, "C:\Program Files\GdPicture.NET\Redist\Commons\OCR", "")
If oGdPictureImaging.GetStat <> GdPictureStatus.OK Then
MsgBox("Error on page " + Str(I) + ": " + oGdPictureImaging.GetStat.ToString)
End If
oGdPictureImaging.OCRTesseractClear()
PrintLine(hFile, "OCR Page " + Str(I))
PrintLine(hFile, "-------------------------------------------------------------------")
PrintLine(hFile, sOCR)
Next I
FileClose(hFile)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Call ShellExecute(Me.Handle.ToInt32, vbNullString, My.Application.Info.DirectoryPath & "\ocr.txt", "", "", 1)
Else
MsgBox("Can't open selected file !")
End If
Code: Select all
oGdPictureImaging.SetLicenseNumberOCRTesseract("license demo") 'Replace XXXX by a valid or commercial KEY
Code: Select all
sOCR = oGdPictureImaging.OCRTesseractDoOCR(ImageID, TesseractDictionary.TesseractDictionaryEnglish, "C:\Program Files\GdPicture.NET\Redist\Commons\OCR", "")
I added GdPicture.NET.9 reference and Import GdPicture9 and GdPictureOCR namespace
what I am missing?
Thanks