Skip to main content

Python quick start for the Windows Document Scanner SDK

Build a lightweight document scanner in Python for Windows.

Create the project and install the Scanbot SDK​

1. Install Python​

Install Python 3 and ensure python and pip are available in your terminal.

2. Create and activate a virtual environment​

python -m venv .env
.\.env\Scripts\Activate.ps1
pip install --upgrade pip setuptools wheel

3. Install the Scanbot SDK​

Replace <SCANBOT_SDK_VERSION> with the version number you want to install. Pick the wheel that matches the architecture of your Python installation.

$env:SCANBOT_SDK_VERSION="<SCANBOT_SDK_VERSION>"
pip install "https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv$env:SCANBOT_SDK_VERSION/scanbotsdk-$env:SCANBOT_SDK_VERSION-py3-none-win_amd64.whl"

4. Verify installation​

python -c "import scanbotsdk; print('scanbotsdk OK')"

Project layout​

Create a minimal project folder with a single entry-point script:

mkdir document-quickstart-python
ni document-quickstart-python\main.py -ItemType File

Initialize the Scanbot SDK​

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

import scanbotsdk
from scanbotsdk import LicenseStatus

SCANBOT_LICENSE_KEY = "<SCANBOTSDK-LICENSE-KEY>"

def initialize_sdk() -> None:
scanbotsdk.initialize(SCANBOT_LICENSE_KEY)
license_info = scanbotsdk.get_license_info()
print(f"License Status: {license_info.status}")
if license_info.status != LicenseStatus.OKAY:
raise SystemExit("Invalid or expired license. Exiting.")

Scan a document image​

The following snippet scans a document from an image.

scan document from ImageRef
loading...

Run​

python main.py C:\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.