Build Document Scanning Apps with Scanner Pro SDK ActiveX Integrating reliable document imaging features into Windows desktop applications requires specialized tools. The Scanner Pro SDK ActiveX control offers developers a straightforward way to add TWAIN and WIA scanning capabilities directly into their software. This guide covers how to get started, initialize the control, and handle scanned images. Core Features of the SDK
The Scanner Pro SDK ActiveX acts as a bridge between your application interface and physical imaging devices.
Dual Protocol Support: Connects seamlessly to both TWAIN and WIA scanners.
Feeder Control: Supports Automatic Document Feeders (ADF) for multi-page batch scanning.
Duplex Scanning: Captures both sides of a document in a single pass if the hardware allows.
Image Adjustments: Built-in functions handle rotation, cropping, and color mode switching (grayscale, black and white, full color).
Format Export: Saves acquired images directly to standard formats including PDF, TIFF, JPEG, and PNG. Setting Up Your Project
To use the ActiveX control, you must first register the component on your development machine and reference it in your development environment (such as Visual Basic 6, Delphi, Visual Studio .NET, or Microsoft Access).
Run the SDK installer or manually register the .ocx file using the command line: regsvr32 scannerpro.ocx. Open your Integrated Development Environment (IDE). Access your toolbox customization menu.
Select and add Scanner Pro SDK ActiveX Control to your available components. Drag and drop the control onto your application form. Initializing and Selecting a Scanner
Before scanning, your application needs to detect available devices and let the user select one. The SDK provides built-in dialogs as well as programmatic selection methods.
’ Visual Basic Example for Device Selection Private Sub Form_Load() ‘ Check if any scanning sources are available If ScannerPro1.DeviceCount > 0 Then ’ Populate a combo box with available scanner names Dim i As Integer For i = 0 & To ScannerPro1.DeviceCount - 1 cmbScanners.AddItem ScannerPro1.GetDeviceName(i) Next i cmbScanners.ListIndex = 0 Else MsgBox “No TWAIN or WIA scanners detected.”, vbExclamation End If End Sub Use code with caution. Configuring Scan Settings
You can programmatically set the scan parameters to bypass the manufacturer’s default user interface. This creates a more integrated experience for the end user.
Private Sub BtnConfigureAndScan_Click() ‘ Select the scanner chosen in the combo box ScannerPro1.SelectDevice(cmbScanners.ListIndex) ’ Configure scanning parameters ScannerPro1.PixelType = 2 ‘ 0 = Black & White, 1 = Grayscale, 2 = True Color ScannerPro1.Resolution = 300 ’ Set DPI to 300 ScannerPro1.HideUI = True ‘ Suppress the scanner manufacturer’s dialog ’ Enable double-sided scanning if needed If ScannerPro1.IsDuplexSupported Then ScannerPro1.EnableDuplex = True End If ‘ Start the acquisition process ScannerPro1.StartScan() End Sub Use code with caution. Handling and Saving Scanned Images
The SDK processes scans asynchronously or handles them via events. Once the pages are captured in the system memory buffer, you can manipulate or save them to a local directory or network share.
’ Event triggered after a page is successfully scanned Private Sub ScannerPro1OnPageScanned(ByVal PageIndex As Long) ‘ Append the scanned page to a multi-page PDF file Dim outputPath As String outputPath = “C:\ScannedDocs\Document” & Format(Date, “yyyymmdd”) & “.pdf” ’ Save image buffer to disk Dim success As Boolean success = ScannerPro1.SavePageAsPDF(PageIndex, outputPath, True) ‘ True appends to existing file If success Then lblStatus.Caption = “Page ” & PageIndex + 1 & “ saved successfully.” Else lblStatus.Caption = “Error saving page.” End If End Sub Use code with caution. Deployment Considerations
When distributing your compiled application to client machines, ensure the following runtime requirements are met:
Include the scannerpro.ocx file (and any dependent DLLs specified in the SDK documentation) in your application installer.
Register the ActiveX control during the installation process on the target machine using administrative privileges.
Ensure the target machines have appropriate manufacturer TWAIN/WIA drivers installed for their specific hardware.
To help refine this implementation, please share what development environment (e.g., C#, VB6, C++) you are using, which file formats you plan to save to, and whether you need features like OCR or barcode reading.
Leave a Reply