Creating PDF with OCR from TWAIN Scanner in V8 doesn't work

Discussions about PDF management.
Post Reply
ifiling
Posts: 9
Joined: Fri Jun 10, 2011 4:34 pm

Creating PDF with OCR from TWAIN Scanner in V8 doesn't work

Post by ifiling » Sat Jul 09, 2011 5:48 pm

I've just upgraded one of our projects to v8 and a routine that was working is now broken. Basically, I can't create a searchable PDF file from images that are captured via the TWAIN source.

This is the code block

Code: Select all

Try
      Dim PdfID As Integer = oGdPictureImaging.PdfOCRStart(_FileName, True, "MyApp", Environment.UserName, "", "", "MyApp")
      Dim imgID As Integer
      For i As Integer = 1 To _imgData.Count
        imgID = CInt(_imgData.Item(i))
        If Not imgID = 0 Then
          Call oGdPictureImaging.PdfAddGdPictureImageToPdfOCR(PdfID, imgID, "eng", _LibPath, "")
          oGdPictureImaging.ReleaseGdPictureImage(imgID)
        End If
      Next
      oGdPictureImaging.PdfOCRStop(PdfID)
    Catch ex As Exception
      MessageBox.Show(ex.Message, "Error Writing PDF.", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
The scanning takes place in a different routine, and the Image ID's are stored in a collection until the operator has finished scanning. This sub is then called. The PDF file is created, but there is no text behind. This was (is) working if I use the v7 components.

ifiling
Posts: 9
Joined: Fri Jun 10, 2011 4:34 pm

Re: Creating PDF with OCR from TWAIN Scanner in V8 doesn't w

Post by ifiling » Sat Jul 09, 2011 11:52 pm

Found the cause of all of my problems. The dictionary format for tesseract has changed. Now there is only one [new] file when using the v8 SDK. I didn't have this file in the specified location.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Creating PDF with OCR from TWAIN Scanner in V8 doesn't w

Post by Loïc » Sat Jul 09, 2011 11:54 pm

Oh ok :)

Thank you for the update on this.
Btw, you should consider to check the returned value of the function of the sdk, this can help you to detect causes of problems. I suppose that the PdfAddGdPictureImageToPdfOCR was returning a DictionnaryNotFound error ;)

Kind regards,

Loïc

ifiling
Posts: 9
Joined: Fri Jun 10, 2011 4:34 pm

Re: Creating PDF with OCR from TWAIN Scanner in V8 doesn't w

Post by ifiling » Wed Jul 13, 2011 11:12 am

You are indeed correct. That's what the error condition was :oops:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest