Rank: Newbie
Groups: Registered
Joined: 12/3/2016(UTC) Posts: 1  Location: Washington
|
FYI - I am using a trial download, I need to confirm this basic functionality will work in my project environment before I buy. I get the following enigmatic error when I try to process jpg file and output as PDF.[/b] An exception of type 'Patagames.Ocr.Exceptions.OcrException' occurred in Patagames.Ocr.dll but was not handled in user code Additional information: Unexpected error code ExtractTextFromImage works with the same settings and same source .jpg in the same test project (but it obviously does not use the OcrPDFRenderer.) Any insight? Code (vb.net): Code:
Public Sub Image2Pdf(filename As String)
'=======Source is a scanned .jpg file that works in the demo "ExtractTextFromImage()"=========
Dim sourceImage As String = filename
'========tessdata is located in the website root dir===========
Dim TessDataPath As String = Server.MapPath("~/")
Dim outputFile As String = Server.MapPath("~/tempimages/") & "output"
Using api = OcrApi.Create()
api.Init(Languages.English, TessDataPath)
'Create the renderer to PDF file output. The extension will be added automatically
Using renderer = OcrPdfRenderer.Create(outputFile, TessDataPath)
'======="output.pdf is created in output directory, however it remains empty=====
renderer.BeginDocument("Title")
'=======Error occurs on next line=======
api.ProcessPages(sourceImage, Nothing, 0, renderer)
renderer.EndDocument()
End Using
End Using
End Sub
Misc Visual Studio 2015, Windows10 Home, Dell PC with 12 gig of memory. Edited by moderator Sunday, December 4, 2016 3:27:22 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Please make sure that the TessDataPath points to tessdata folder like following Code:
OcrPdfRenderer.Create("multipage_pdf_file", @"c:\YourApp\tessdata\"))
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
Thanks for insisting. The confusing thing for me is that the init for languages wants the parent folder above tessdata ("c:\[app]\") e,g, (api.Init(languages.English,"c:\app\") while the init for the Renderer wants the tessdata folder included in the pass spec OcrPdfRenderer.Create(outputfile,"C:\[app]\tessdata").
It took me a while to believe that was the case.
Thanks again. The conversion code works now. It's a sale.
|
|
|
|
|
|
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.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close