logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
wengilman  
#1 Posted : Sunday, May 22, 2016 5:30:12 PM(UTC)
wengilman

Rank: Newbie

Groups: Registered
Joined: 5/22/2016(UTC)
Posts: 2
United States
Location: Kentucky

I just purchased your SDK and can not get the Tiff2PDF to work without an exception error. See below. I have the .LicenseKey set.
I was able to get the ExtractTextFromImage to work without issue. Could it be file rights???

Any help would be greatly appreciated.

will

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
Patagames.Ocr.Exceptions.OcrException: Unexpected error code
at Patagames.Ocr.OcrApi.ProcessPages(String filename, String retryConfig, Int32 timeout, OcrResultRenderer renderer)
at ProofOfConceptOCR.ProofOfConcept.Tiff2Pdf() in F:\ProofOfConceptOCR\ProofOfConceptOCR\ProofOfConceptOCR\Form1.cs:line 63
at ProofOfConceptOCR.ProofOfConcept.button1_Click(Object sender, EventArgs e) in F:\ProofOfConceptOCR\ProofOfConceptOCR\ProofOfConceptOCR\Form1.cs:line 103
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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1080.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

ProofOfConceptOCR
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///F:/ProofOfConceptOCR/ProofOfConceptOCR/ProofOfConceptOCR/bin/Debug/ProofOfConceptOCR.exe

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1078.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

Patagames.Ocr
Assembly Version: 1.8.0.341
Win32 Version: 1.8.0.341
CodeBase: file:///F:/ProofOfConceptOCR/ProofOfConceptOCR/ProofOfConceptOCR/bin/Debug/Patagames.Ocr.DLL


************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Paul Rayman  
#2 Posted : Sunday, May 22, 2016 5:46:24 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 902

Thanks: 3 times
Was thanked: 110 time(s) in 107 post(s)
Hi,
Please send your tiff file to support@patagames.com. I will check it.
Thanks.

Upd: also let me see your code please.

Edited by user Sunday, May 22, 2016 5:48:53 PM(UTC)  | Reason: Not specified

wengilman  
#3 Posted : Sunday, May 22, 2016 5:59:02 PM(UTC)
wengilman

Rank: Newbie

Groups: Registered
Joined: 5/22/2016(UTC)
Posts: 2
United States
Location: Kentucky

I finally figured it out. I did not fully understand:
var renderer = OcrPdfRenderer.Create("multipage_pdf_file", @"c:\YourApp\tessdata\"

I was not pointing to the tessdata correctly.


Thanks!
pilotFrankie  
#4 Posted : Friday, June 24, 2016 2:48:31 PM(UTC)
pilotFrankie

Rank: Newbie

Groups: Registered
Joined: 6/23/2016(UTC)
Posts: 4
United States
Location: Pleasant Hill

I am having the same problem in the same place.
my code is VB.net as follows:

Public Sub Tiff2Pdf()
OcrApi.LicenseKey = "~a03303bf55a "
Using api = OcrApi.Create()

api.Init(language:="Eng")
'Create the renderer to PDF file output. The extension will be added automatically
Using renderer = OcrPdfRenderer.Create("multipage_pdf_file", "c:\test2\")
renderer.BeginDocument("Test")
api.ProcessPages("c:\test1\multipage.tif", Nothing, 0, renderer)
renderer.EndDocument()
End Using
End Using
End Sub

I get an error with the line:
api.ProcessPages("c:\test1\multipage.tif", Nothing, 0, renderer)

The error is:

An unhandled exception of type 'Patagames.Ocr.Exceptions.OcrException' occurred in Patagames.Ocr.dll
Paul Rayman  
#5 Posted : Tuesday, June 28, 2016 8:40:37 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 902

Thanks: 3 times
Was thanked: 110 time(s) in 107 post(s)
I'm guessing you're not pointing to the tessdata correctly too.

Using renderer = OcrPdfRenderer.Create("multipage_pdf_file", "c:\test2\tessdata")

Edited by user Tuesday, June 28, 2016 8:41:18 AM(UTC)  | Reason: Not specified

pilotFrankie  
#6 Posted : Wednesday, June 29, 2016 4:14:40 PM(UTC)
pilotFrankie

Rank: Newbie

Groups: Registered
Joined: 6/23/2016(UTC)
Posts: 4
United States
Location: Pleasant Hill

I changed the path to the tessdata to:
Using renderer = OcrPdfRenderer.Create("multipage_pdf_file", "C:\Tesseract\TesseractTest\TesseractTest\bin\Debug\tessdata")

The data is located in that path; however, I am still getting an error with:
'api.ProcessPages(" c:\test1\multipage.tif", Nothing, 0, renderer)

Is this the correct format for VB.net?


+ [Iterator] 'api.[Iterator]' threw an exception of type 'Patagames.Ocr.Exceptions.CantGetIteratorException' Patagames.Ocr.OcrResultIterator {Patagames.Ocr.Exceptions.CantGetIteratorException}
+ LoadedLanguages {Length=1} String()
MutableIterator Nothing Patagames.Ocr.OcrMutableIterator
OutputName Nothing String
PageSegmentationMode PSM_SINGLE_BLOCK {6} Patagames.Ocr.Enums.PageSegMode
+ Rectangle {X = 0 Y = 0 Width = 0 Height = 0} System.Drawing.Rectangle
+ SourceResolution 'api.SourceResolution' threw an exception of type 'System.AccessViolationException' Integer {System.AccessViolationException}
TextConfidences 0 Integer
ThresholdedImage Nothing Patagames.Ocr.OcrPix
ThresholdedImageScaleFactor 0 Integer
Version "3.04.01dev" String
Paul Rayman  
#7 Posted : Wednesday, June 29, 2016 9:25:14 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 902

Thanks: 3 times
Was thanked: 110 time(s) in 107 post(s)
'api.ProcessPages(" c:\test1\multipage.tif", Nothing, 0, renderer)

+ [Iterator] 'api.[Iterator]' threw an exception of type 'Patagames.Ocr.Exceptions.CantGetIteratorException'


This line of code (api.ProcessPages) cannot throw the CantGetIteratorException exception.
Please be carefull when describing your issue.
pilotFrankie  
#8 Posted : Thursday, June 30, 2016 2:58:02 PM(UTC)
pilotFrankie

Rank: Newbie

Groups: Registered
Joined: 6/23/2016(UTC)
Posts: 4
United States
Location: Pleasant Hill

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:
Paul Rayman  
#9 Posted : Sunday, July 3, 2016 7:59:58 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 902

Thanks: 3 times
Was thanked: 110 time(s) in 107 post(s)
Originally Posted by: pilotFrankie Go to Quoted Post

Using renderer = OcrPdfRenderer.Create("multipage_pdf_file", "C:\Tesseract\TesseractTest\TesseractTest\bin\Debug\tessdata")


Please make sure the tessdata folder is located in the path above and contains language datafailes.
Also please check the path to image, In your sample it contains a space character at the begining.
Please download and try tiff file from here: https://tesseract.pataga...help/Media/multipage.tif
For testing purposes only.
Try to add path to tessdata parent folder into Init method.
Like shown below
Code:

api.Init(Languages.English, @"C:\Tesseract\TesseractTest\TesseractTest\bin\Debug\");

Try to create console app instead WinForms. Tesseract may log some errors into console.
If nothing helps, please provide me you test app, I'll examine it.
Thanks.

pilotFrankie  
#10 Posted : Monday, July 4, 2016 2:34:45 PM(UTC)
pilotFrankie

Rank: Newbie

Groups: Registered
Joined: 6/23/2016(UTC)
Posts: 4
United States
Location: Pleasant Hill

The error was the space in the path to the image. Thank you for the help.
Ken Patton  
#11 Posted : Monday, July 13, 2020 8:44:44 AM(UTC)
Ken Patton

Rank: Newbie

Groups: Registered
Joined: 10/11/2016(UTC)
Posts: 7
United States

I am also now receiving this error. Here is my code:

Code:
                            using (var api = OcrApi.Create())
                            {
                                api.Init(Patagames.Ocr.Enums.Languages.English);

                                //Create the renderer to PDF file output. The extension will be added automatically
                                using (var renderer = OcrPdfRenderer.Create(searchable_pdfFile, System.Windows.Forms.Application.StartupPath + @"\tessdata\"))
                                {
                                    try
                                    {
                                        renderer.BeginDocument("Title");
                                        api.ProcessPages(TempFolder + @"\LSU_PDF_IMAGE_LIST.TXT", null, 0, renderer);
                                        renderer.EndDocument();
                                    }
                                    catch (Exception ex)
                                    {
                                        //Write To The Report
                                        Trace.WriteLine("ERROR - Unable To Create Searchable PDF: " + searchable_pdfName + "|" + ex.Message);

                                        //Increment Tot_Errors
                                        Tot_Errors++;
                                    }
                                }
                            }


The error happens with the following call:

api.ProcessPages(TempFolder + @"\LSU_PDF_IMAGE_LIST.TXT", null, 0, renderer);

Edited by moderator Monday, July 13, 2020 10:53:04 PM(UTC)  | Reason: Not specified

Paul Rayman  
#12 Posted : Monday, July 13, 2020 10:56:59 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 902

Thanks: 3 times
Was thanked: 110 time(s) in 107 post(s)
What is the contents of the LSU_PDF_IMAGE_LIST.TXT file?
Could you send a simple console application to support@patagames.com with all the necessary files where this problem is reproduced.

Edited by user Monday, July 13, 2020 10:59:38 PM(UTC)  | Reason: Not specified

Ken Patton  
#13 Posted : Tuesday, July 14, 2020 10:30:51 AM(UTC)
Ken Patton

Rank: Newbie

Groups: Registered
Joined: 10/11/2016(UTC)
Posts: 7
United States

The content of the file is as follows:

C:\Users\kpatton\Desktop\LSU_TEMP\6276\Searchable_PDFs\LSU_PDFs_IMAGES\1.tif
C:\Users\kpatton\Desktop\LSU_TEMP\6276\Searchable_PDFs\LSU_PDFs_IMAGES\1.00000002.tif

These were 2 scanned pages from a PDF file which were being converted to searchable pages in a new PDF. The code provided earlier was working without issue when I was using .Net framework 4.5. I am now on .Net framework 6.2. This is a small section of code within a much larger program. A fellow employee pointed out the fact that it was not working anymore which prompted me to investigate.
Ken Patton  
#14 Posted : Tuesday, July 14, 2020 10:32:52 AM(UTC)
Ken Patton

Rank: Newbie

Groups: Registered
Joined: 10/11/2016(UTC)
Posts: 7
United States

Sorry meant to say .Net Framework 4.6.2
Ken Patton  
#15 Posted : Tuesday, July 14, 2020 10:43:46 AM(UTC)
Ken Patton

Rank: Newbie

Groups: Registered
Joined: 10/11/2016(UTC)
Posts: 7
United States

In addition, I am including all files related to this issue.


LSU_PDF_IMAGE_LIST.TXT (1kb) downloaded 0 time(s). api.ProcessPages_Error.png (20kb) downloaded 1 time(s). 1.00000002.tif (85kb) downloaded 0 time(s). 1.tif (183kb) downloaded 0 time(s).
Ken Patton  
#16 Posted : Wednesday, July 15, 2020 8:30:43 AM(UTC)
Ken Patton

Rank: Newbie

Groups: Registered
Joined: 10/11/2016(UTC)
Posts: 7
United States

Found the issue. Chock this one up to my own stupidity. I had not yet created the destination directory.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.