Platform : Windows 11, Windows 10, Windows 8, Vista, XP
It is a PDF Viewer and Document Viewer SDK , Export to PDF ,Image processing, 1D and 2D Barcode Reader, Writer, DICOM and OCR with C#, C , VB.NET , VB, Delphi, Vfp, MS Access.
Step 1: To install the Image Viewer CP Pro SDK ActiveX, begin by launching the setup file (http://www.viscomsoft.com/demo/imageviewercpprosetup.exe). Select the desired installation folder for the Image Viewer CP Pro SDK ActiveX and continue with the installation on your development computer.
Step 2: Launch MS Access 2016. select Blank database.
Step 3: Select Create Tab, select Form Design.
Step 4: Select Design Tab, Select ActiveX Control. Select Image Viewer CP Pro ActiveX Control.
Step 5: Resize the Image Viewer CP Pro ActiveX Control on form and add the following UI on form (2 button, 6 textbox , 10 label, 2 option button control)
Step 6: double click button 1 , then Select Tools - References... , select Microsoft Office 16.0 Object Library, click OK button.
Step 7: In Command1 button click event, add the following code
Private Sub Command1_Click()
Dim dlg As FileDialog
Dim bResult As Boolean
Dim strFile As String
Dim obj As ImageViewer
Set obj = ImageViewer0.Object
Set dlg = Application.FileDialog(msoFileDialogOpen)
bResult = dlg.Show
If bResult Then
strFile = dlg.SelectedItems(1)
txtFileName.Value = strFile
obj.FileName = strFile
obj.View = 5
obj.MouseTrackMode = SelectionRectMode
End If
End Sub
Step 8: In Command2 button click event, add the following code
Private Sub Command2_Click()
Dim dlg As FileDialog
Dim iresult As Integer
Dim obj As ImageViewer
Dim strOutputFileName As String
Set obj = ImageViewer0.Object
obj.OCRScanTextAsync False
obj.OCRCharFilter = ""
If OptionGroupZone.Value = 1 Then
obj.OCRSetRect 0, 0, 0, 0
Else
obj.OCRSetRect txtleft, txttop, txtwidth, txtheight
End If
obj.OCRRecognizeMode = 1
iresult = obj.OCRStartScan(0, "dictfiles")
If iresult = -3 Then
MsgBox "Please select image first"
Exit Sub
Else
txtRecognizedCharCount.Value = obj.OCRGetRecognizedCharCount
MsgBox obj.OCRGetRecognizedText
End If
End Sub
Step 9: In code editor, select ImageViewer0, select SelectionRectDrawn event.
Step 10: In SelectionRectDrawn event, add the following code
Private Sub ImageViewer0_SelectionRectDrawn(ByVal iLeft As Long, ByVal iTop As Long, ByVal iWidth As Long, ByVal iHeight As Long)
If OptionGroupZone.Value = 2 Then
txtleft = iLeft
txttop = iTop
txtwidth = iWidth
txtheight = iHeight
End If
End Sub
Step 11: In Form load event, add the following code
Private Sub Form_Load()
txtleft = 0
txttop = 0
txtwidth = 0
txtheight = 0
Me.OptionGroupZone.DefaultValue = 1
End Sub
Step 12: Right click the Form1, then select "Open" menu item. Then you may run the form
Download the source code of the read text (OCR) from an image and PDF file sample