G
Guest
Hello,
I’m using a multithreaded windows service to listen a file directory and
process TIF documents.
For example if user drops 3 files to the directory,
“fileSystemWatcher_Created†event will create 3 threads.
Each thread has to process the same function.
1. Decompress file
2. Read text data from the TIF image (I’m are using “LEAD Technologies OCR
componentâ€
3. Create new document record in database
For each call to rasterOcr.StartUp() there must be a call to the
RasterOcr.ShutDown method.
Now I run into problem. My first thread didn’t finish process and didn’t
call RasterOcr.ShutDown method, but the second one trying to call StartUp.
What should I do? How can I manage them. Please point me to the right
direction.
To read data from the image I’m doing something like this.
Public Shared Function ScanFaxImage(ByVal path As String) As String
Dim rasterOcr As New rasterOcr
Dim codecs As RasterCodecs
Dim rasterImage As IRasterImage
Dim recognizedChars() As RasterOcrRecognizedCharacters
RasterSupport.Unlock(RasterSupportType.Ocr, _
ApolloScanSettings.OCRSupportKey)
rasterOcr.StartUp()
codecs = LoadCodecs()
rasterImage = codecs.Load(path)
'Add the cover sheet of the fax
rasterOcr.AddPage(rasterImage, 0)
rasterOcr.AutoOrientPage(0)
rasterOcr.EnableZoneForceSingleColumn = True
rasterOcr.ShowZoneGridLines = False
'Automatically find zones
rasterOcr.FindZones(0)
'Scan the image for recognize characters and return result
rasterOcr.ShutDown()
End Function
I’m using a multithreaded windows service to listen a file directory and
process TIF documents.
For example if user drops 3 files to the directory,
“fileSystemWatcher_Created†event will create 3 threads.
Each thread has to process the same function.
1. Decompress file
2. Read text data from the TIF image (I’m are using “LEAD Technologies OCR
componentâ€
3. Create new document record in database
For each call to rasterOcr.StartUp() there must be a call to the
RasterOcr.ShutDown method.
Now I run into problem. My first thread didn’t finish process and didn’t
call RasterOcr.ShutDown method, but the second one trying to call StartUp.
What should I do? How can I manage them. Please point me to the right
direction.
To read data from the image I’m doing something like this.
Public Shared Function ScanFaxImage(ByVal path As String) As String
Dim rasterOcr As New rasterOcr
Dim codecs As RasterCodecs
Dim rasterImage As IRasterImage
Dim recognizedChars() As RasterOcrRecognizedCharacters
RasterSupport.Unlock(RasterSupportType.Ocr, _
ApolloScanSettings.OCRSupportKey)
rasterOcr.StartUp()
codecs = LoadCodecs()
rasterImage = codecs.Load(path)
'Add the cover sheet of the fax
rasterOcr.AddPage(rasterImage, 0)
rasterOcr.AutoOrientPage(0)
rasterOcr.EnableZoneForceSingleColumn = True
rasterOcr.ShowZoneGridLines = False
'Automatically find zones
rasterOcr.FindZones(0)
'Scan the image for recognize characters and return result
rasterOcr.ShutDown()
End Function