Skip to main content

Node.js quick start for the Linux Document Scanner SDK

Build a lightweight document scanner in Node.js for Linux.

Create the project and install the Scanbot SDK​

1. Create a new project​

mkdir document-quickstart-node
cd document-quickstart-node
npm init -y

2. Install the Scanbot SDK​

Replace <SCANBOT_SDK_VERSION> with the version number you want to install.

export SCANBOT_SDK_VERSION=<SCANBOT_SDK_VERSION>
npm install https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv${SCANBOT_SDK_VERSION}/nodejs-scanbotsdk-${SCANBOT_SDK_VERSION}.tgz

3. Verify installation​

node -e "console.log(require('scanbotsdk') ? 'Scanbot SDK loaded' : 'Error')"

Project layout​

Create a single entry-point file:

touch main.ts

Initialize the Scanbot SDK​

Before using any feature of the Scanbot SDK, initialize the SDK with your license key.

import * as ScanbotSDK from "scanbotsdk";

const SCANBOT_LICENSE_KEY = "<SCANBOTSDK-LICENSE-KEY>";
await ScanbotSDK.initialize({ licenseKey: SCANBOT_LICENSE_KEY });
const licenseInfo = await ScanbotSDK.getLicenseInfo();
console.log("License Status:", licenseInfo.status);

Scan a document image​

The following snippet scans a document from an image.

scan document from ImageRef
loading...

Run​

npx ts-node main.ts /path/to/document_image.jpg

Get in touch​

If you need further information or are interested in licensing the Scanbot SDK, please get in touch with our solution experts.