将PDF文件分解成图片后,并显示在PictureBox控件中,然后对PictureBox控件中当前显示的图片进行识别。
但是如何获取图片的ImageFile,转入第二段代码中运行?
谢谢!
'1、将PDF文件分解成图片
Dim Pdfv As new PDFView.ConvertPDF.PDFConvert
Dim pcb As WinForm.PictureBox = e.form.Controls("照片")
Dim rz As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox3")
_pdfWrapper.CurrentPage = rz.text
pcb.Image = _pdfWrapper.Pages(_pdfWrapper.CurrentPage).GetBitmap(pcb.Width, pcb.Height,True)
msgbox(pcb.ImageFile) ‘获取为空
'2、文字识别
If pbx.ImageFile <> "" Then
Dim doc = CreateObject("MODI.Document")
doc.Create(pcb.ImageFile)
doc.OCR(2052, True, True)
For i As Integer = 0 To doc.Images.count - 1
Dim layout = doc.images(i).Layout
Next i
doc.close
doc = Nothing
Else
msgbox("未添加图片!")
End If