gpt4 book ai didi

vb6 - 如何处理VB6中的OCR扫描错误

转载 作者:行者123 更新时间:2023-12-03 07:55:18 25 4
gpt4 key购买 nike

我试图获取我可以从图片文档中获得的所有信息。其中包括手写内容。在扫描此即时消息时,我的屏幕像 hell 一样死机,然后给出错误消息,提示VB6停止工作...我无法真正找到导致此问题的原因,所以如果有错误或OCR故障,我只想克服它。可悲的是,它还没有成功。这是我到目前为止所做的:

Dim Mdoc As MODI.Document
Dim Mlay As MODI.Layout
Dim fso As Scripting.FileSystemObject
Dim logfile As Object

Public Function ScanMan(ByVal Name As String, ByVal Path As String) As String
Set Mdoc = New MODI.Document
'Set Mdoc = CreateObject("MODI.Document")
Set fso = New Scripting.FileSystemObject

DoEvents
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''' Create OCRLog File '''''''''''''''''''
OCRPath = App.Path & "\OCR Results Log\"
OCRName = Str(DateTime.Date) & " OCRresults"
If fso.FolderExists(OCRPath) = False Then
fso.CreateFolder (OCRPath)
End If
If fso.FileExists(OCRPath & OCRName & ".txt") = False Then
fso.CreateTextFile OCRPath & OCRName & ".txt"
End If
Set logfile = fso.OpenTextFile(OCRPath & OCRName & ".txt", ForAppending)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

On Error GoTo OCRErr
DoEvents
Mdoc.Create Path & Name
Mimg = Mdoc.Images(0).OCR(miLANG_ENGLISH, True, True)
Set Mlay = Mdoc.Images(0).Layout
logfile.WriteLine Mlay.Text

ScanMan = Mlay.Text

Mdoc.Close False

Set Mlay = Nothing
Set Mdoc = Nothing

OCRErr:
logfile.WriteLine "OCR given (" & Err.Number & ") numbered (" & Err.Description & ") error."
logfile.Close
End Function

那么我该如何处理冻结问题呢?

最佳答案

尝试以下操作:

Mdoc.Images(0).OCR
logfile.Write Mdoc.Images(0).Layout.Text

希望这可以帮助。

关于vb6 - 如何处理VB6中的OCR扫描错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10847710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com