You are viewing limited content. For full access, please sign in.

Question

Question

OCRIsAvailable

asked on March 8, 2016

I am trying to get some code that OCRs a document to work as expected. The program works perfectly on the development computer, but fails out on "ocr.OCRMarkedPages(docPages)" on a test machine. Initially I had it set the OCR optimization to speed, but that caused an error so I fell back to other methods to get it past that point on the test machine.

 

    Sub OCR(ByVal newDocument As LFDocument)
        Do
            WriteEvent("Setup ocr engine.")
            Dim ocr As New OCREngine
            Try
                WriteEvent("Set optimization mode.")
                Try
                    ocr.OptimizationMode = OCR_Optimization_Mode.OCR_OPTIMIZATION_SPEED
                Catch ex As Exception
                    Try
                        ocr.OptimizationMode = OCR_Optimization_Mode.OCR_OPTIMIZATION_BALANCED
                    Catch ex2 As Exception
                        Try
                            ocr.OptimizationMode = OCR_Optimization_Mode.OCR_OPTIMIZATION_ACCURACY
                        Catch ex3 As Exception
                            WriteEvent("Tried set OCR Optimization mode 3 times..." & vbCrLf & ex.Message & vbCrLf & ex2.Message & vbCrLf & ex3.Message & vbCrLf & "Leaving as default.")
                        End Try
                    End Try
                End Try
                WriteEvent("Get number of pages.")
                Dim docPages As LFDocumentPages = newDocument.Pages
                WriteEvent("Mark pages.")
                docPages.MarkAllPages()
                WriteEvent("Start OCR.")
                ocr.OCRMarkedPages(docPages)
                WriteEvent("Finished OCR.")
                Exit Do
            Catch ex As Exception
                WriteEvent(ex.Message, EventLogEntryType.Error)
                If ocr.OCRIsAvailable = False Then
                    WriteEvent("OCR Is Not Available...", EventLogEntryType.Error)
                    Exit Do
                End If
            End Try
        Loop While True
    End Sub
 

The LF 10 SDK Runtime is installed on the test machine. The ex.Message which is put to the Event log has no text. I can run the OCR from the client without any problems. Any ideas where to check?

 

Thanks.

0 0

Replies

replied on March 8, 2016

Also forgot to mention that the ocr.OCRIsAvailable does come up as false and the OCR Is Not Available... does come up in the Event Viewer.

0 0
replied on March 9, 2016

Is you application 32 or  64 bits? Per development the above error message is expected if the Laserfiche Ocr engine is not present on the machine. From Control Panel > programs and features  ensure Laserfiche OCR with Ominipage is installed on the machine if not please make sure it is installed on the machine.

The sdk application should be x86.

replied on March 9, 2016

Is your application 32 or 64 bit? ensure Laserfiche OCR with Omnipage 18.5 is listed under Programs and features at the machine where you are running the application. 

For sdk application with sdk , ensure the application is  x86. 

 

0 0
replied on March 9, 2016

The application is 32-bit.

Looks like the Laserfiche OCR with Omnipage 18.5 was not installed, but still allowed for OCR in the client. Not sure how that works...

Installed the OCR engine and tried again and it still has the same error. One blank entry and one that states "OCR Is Not Available...".

 

0 0
replied on March 9, 2016

If you are generating text from PDF docs , then depending on your settings , you might be using PdfImporter to extract the embedded text from the pdf, therefore it might looks like OCR engine is working. 

Make sure you can generate text from tiff files , you can use the sample tiff files that are included within the lf client installation path to generate text. From Laserfiche Client> Tools> Options> Generate Text > OCR Engine should be set to Omnipage 18.5. 

 

0 0
replied on March 10, 2016

The documents are not PDF.

I am able to OCR the same documents I am trying to through the SDK in the client. Will check to make sure it is using the same OCR engine.

0 0
replied on March 10, 2016 Show version history

After changing to the Omnipage 18.5 it tells me "Loading the OCR engine failed." Switched it back to the default Omnipage and it works fine.

0 0
replied on March 10, 2016

What do you mean by "Switched it back to default Omnipage .."? Please take a screen-print of the OCR settings from Laserfiche Client, it sounds like the old OCR engine is still in place. 

 

0 0
replied on March 10, 2016 Show version history

The test computer is a bit older machine and has Laserfiche 8.2 on it. It has previously been able to run the same code when it is importing different files, which does confuse me. This process is an Add In, and my first attempt at one on my own. I used the Google Maps search as the base with adding the code and the libraries that were required, making sure to use the Laserfice 8.2 libraries for the Doc Processor, LFSO, and PDF Exporter. Laserfiche Imaging is the only process that is higher than 8.2.

 

There are some other computers this may be released on that may initially be 8.2, but I hope to get to upgrade to a higher version... just have to have a proof of concept that will work on it first.

 

Would it be required to upgrade the clients?

0 0
replied on March 16, 2016

I did try it on a different computer running Laserfiche 8.2 and it still has the same error.

If I can find out that the error is due to the client version, I can continue down that road and make the requirement to using the program to upgrade the client. Just want to make sure that is the issue before continuing and not something else.

The Add In process is based in part on the Using Google to Map Locations in Address Fields (https://support.laserfiche.com/CodeLibraryFrames.aspx?id=375) and the Creating a New Document program (https://support.laserfiche.com/CodeLibraryFrames.aspx?id=388).

I have used the Creating a New Document program as a skeleton for some programs that can search a directory, import all files in the directory and sub directories, add information about the file in metadata fields, OCR the documents, pull other metadata from spreadsheets, and so on.

The OCR was copied directly from one of these import programs that worked on the same test computer, so I would have thought it should work. I added some debug code to try and identify where it was crashing.

Is there something about using the ImageEnable to get the current selected entry or the connection that may cause the OCR code to fail on clients older than 9 or 10? Would that code still allow exporting the documents as PDF and TIFF files as that code works properly?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.