Skip to main content

Getting started | Web Document and Barcode Scanner

Adding the Dependency#

Scanbot Web Document and Barcode Scanner SDK is available as an npm package:

npm install scanbot-web-sdk --save

In webpack-based projects you can import the package like so:

import ScanbotSDK from 'scanbot-web-sdk/webpack'

This will ensure that the web worker and WebAssembly components are automatically copied over by webpack into the webpack output folder.

If you want to manually handle those components, import the SDK without the /webpack suffix:

import ScanbotSDK from 'scanbot-web-sdk'

Then, make sure to copy the following files from the package to your web folder:

  • ScanbotSDK.Core.js
  • ScanbotSDK.Asm.wasm

The npm package contains typings under the @types directory, so you can import it in your preferred typescript project, as well as the minified bundle (will even work with vanilla javascript) in the bundle directory.

If you do not use a bundler (webpack, etc.) in your project, you can put a <script src="ScanbotSDK.min.js"></script> tag in your index.html. The script puts the SDK entry point into a global variable named ScanbotSDK. Copy ScanbotSDK.min.js from the package's bundle folder to your web folder.