NAV Navbar
  • Electron Scanner for Windows 10
  • Electron Scanner for Windows 10

    The Windows scanner for Electron is a bridge between the native Windows WIA library and node js.

    This allows it to call a physical scanner through Electron node-js on Windows.

    Requirements

    Implementation

    Step 1: package.json

    {
        "dependencies": {
            "verifai-scanner": "file:./path/to/scanner/dist",
            "verifai-websdk": "file:./path/to/websdk/dist"
        }
    }
    

    The verifai scanner module uses the Electron internal messaging system to communicate between the Electron node-js and the renderer.

    To implement scanner support for the Web SDK, please follow the next steps:

    Step 1: package.json

    Step 2: Electron main.js

    Step 2: Electron main.js

    const electron = require('electron')
    const verifaiScanner = require('verifai-scanner')
    verifaiScanner.link(electron)
    

    Link the scanner to your electron instance as shown to the right in your main electron js file.

    Step 3: Electron renderer.js

    Step 3: Electron renderer.js

    const electron = require('electron')
    const verifai = require('verifai-websdk')
    
    const config  = {
      token: "<OTP_TOKEN>",
      assetsUrl: 'dist/assets',
    
      electron: electron,
      uploadType: ['scanner']
    
      // ... other Web SDK config
    }
    
    // Get the element Verifai should be mounted on
    const verifaiElement = Document.getElementById('verifai-mount')
    
    // Create a Web SDK object
    const webSDK = new Verifai.WebSDK(config, verifaiElement)
    
    // Start the SDK
    webSDK.start()
    

    To implement the Web SDK in Electron you can follow the normal guide: Implementing the frontend

    Be sure to:

    As shown to the right.

    Optional: Configuring the scanner

    The scanner can be configured by passing an array as the uploadType. This is shown to the right.

    The scanner config object can have the following properties:

    Key Type Default Comment
    width int 3000 Width of the scan
    height int 2900 Height of the scan
    resolution int 600 Scan resolution
    format str jpeg Image format: jpeg, bmp, png
    rotation int 0 Image rotation: 0, 90, 180, 270
    color bool true Use color

    Optional: Scanner configuration

    const config = {
    
      // ... other Web SDK config
    
      uploadType: [
        'phone',
        'file'
        ['scanner', {rotation: 180}]
      ]
    }