here is the code for my simple test project:
Imports System.IO
Imports Patagames.Ocr
Public Class Form1
Private Sub btnOCR_Click(sender As Object, e As EventArgs) Handles btnOCR.Click
Tiff2Pdf()
End Sub
Public Sub Tiff2Pdf()
OcrApi.LicenseKey = "5243355...303bf55a "
Using api = OcrApi.Create()
api.Init(language:="Eng")
Using renderer = OcrPdfRenderer.Create("multipage_pdf_file", "C:\Tesseract\TesseractTest\TesseractTest\bin\Debug\tessdata")
renderer.BeginDocument("Test")
api.ProcessPages(" c:\test1\multipage.tif", Nothing, 0, renderer)
renderer.EndDocument()
End Using
End Using
End Sub
End Class
The project compiles with no build errors but debug execution stops at the line:
api.ProcessPages(" c:\test1\multipage.tif", Nothing, 0, renderer)
the output window shows:
Exception thrown: 'Patagames.Ocr.Exceptions.OcrException' in Patagames.Ocr.dll
'TesseractTest.vshost.exe' (CLR v4.0.30319: TesseractTest.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The execption detail is listed as:
Patagames.Ocr.Exceptions.OcrException was unhandled
HResult=-2146233088
Message=Unexpected error code
Source=Patagames.Ocr
StackTrace:
at Patagames.Ocr.OcrApi.ProcessPages(String filename, String retryConfig, Int32 timeout, OcrResultRenderer renderer)
at TesseractTest.Form1.Tiff2Pdf() in C:\Tesseract\TesseractTest\TesseractTest\Form1.vb:line 50
at TesseractTest.Form1.btnOCR_Click(Object sender, EventArgs e) in C:\Tesseract\TesseractTest\TesseractTest\Form1.vb:line 18
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at TesseractTest.My.MyApplication.Main(String[] Args) in :line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: