barKoder Web SDK - Installation

Requirements #

WebAssembly is a type of code that can be run in modern web browsers — it is a low-level assembly-like language with a compact binary format that runs with near-native performance and is designed to run alongside JavaScript. The following requirements need to be met:

  1. Client: Chrome 64+, Firefox 69+, Edge 79+, Safari 13.1+, iOS Safari 13.4+Camera usage permission (if using startScanner)
  2. Chrome 64+, Firefox 69+, Edge 79+, Safari 13.1+, iOS Safari 13.4+
  3. Camera usage permission (if using startScanner)
  4. Server: HTTPS, MIME type for WASM files
  5. HTTPS, MIME type for WASM files

Install #

                npm install barkoder-wasm
            

Install Manually #

If you would like to install from a local folder you will need to follow these steps:

  • Download zip (get it here)
  • Unpack zip file
  • Rename folder to your liking
  • Paste the folder in app directory i.e. myApp/barkoder-wasm (this is the new name of the download module folder)
  • Finally in your cli (within your app's directory):
                npm install "./barkoder-wasm"
            

Using the SDK #

Browser #

Copy both barkoder-umd.js and barkoder.wasm to your page's directory.

Include the barkoder-umd.js script:

                <script type="text/javascript" src="barkoder-umd.js"></script>
            

CommonJS #

Copy barkoder.wasm to your page's directory (i.e. dist).

Require the UMD Module:

                var BarkoderSDK = require('barkoder-wasm');
            

Then,

  • In your js file:
                async function barkoderInit () {
    var Barkoder = await BarkoderSDK.initialize("your_license_key_here");

    //enable symbologies you'd like to scan
    Barkoder.setEnabledDecoders(
        Barkoder.constants.Decoders.QR,
        Barkoder.constants.Decoders.Ean8,
        Barkoder.constants.Decoders.PDF417
    );

    //change any additional settings
    Barkoder.setCameraResolution(Barkoder.constants.CameraResolution.FHD);
    Barkoder.setDecodingSpeed(Barkoder.constants.DecodingSpeed.Normal);
}

barkoderInit(); //using await requires an async method
            
  • In your HTML file add a div with barkoder-container id:
                <div id="barkoder-container" style="width: 500px; height: 300px;"></div>
            

Additionally add style for size, position, background color, etc.Note that the container element needs to have a defined size, otherwise the SDK will set half the window size as fallback.

  • Finally, you are ready to scan:
                let callbackMethod = (result)=>alert&#40;result.barcodeTypeName + '\n' + result.textualData&#41;;

Barkoder.startScanner(callbackMethod);
Barkoder.stopScanner();

Barkoder.scanImage('test.png', callbackMethod);
            

Trial License #

If you run the barKoder Barcode Scanner SDK without a valid trial or production license, all results upon successful barcode scans will be partially masked by asterisks (*). You can get a trial license simply by registering on the barKoder Portal and utilizing the self-service for Evaluation License Generation! Each trial license will be good for an initial duration of 30 days and can be deployed to up to 25 devices. For any custom requirements, contact our sales team via sales@barkoder.com

Note that a trial license is only supposed to be utilized in a development or staging environment.

Free Developer Support #

Our support is completely free for integration or testing purposes and granted through the barKoder Portal. After registering and logging into your account, you only need to submit a Support Issue form. Alternatively, you can contact us by email via support@barkoder.com.

Page Contents

History:

close