SDK DocsScan Session

ScanSession — Card Scanning

evolis.ScanSession controls the optional WiseCube scanner module available on some Evolis printers.

Requires the WiseCube dynamic library (wsdef.dll on Windows). Call ScanSession.set_library_path() first.

Static Methods

ScanSession.set_library_path(path: str) -> bool

Set the path to the WiseCube scanner library.

evolis.ScanSession.set_library_path("C:/WiseCube/wsdef.dll")

ScanSession.get_library_path() -> str

Retrieve the currently configured scanner library path.

Constructor

ScanSession(connection: Connection)

Automatically calls init().

Methods

init() -> bool

Reset session: clears previous images and resets options to defaults.

get_option(option: ScanOption) -> int

Get a scanning option value.

set_option(option: ScanOption, value: int) -> bool

Set a scanning option (resolution, depth, format, etc.).
See SettingKey entries WIScan* for available options.

send_command(cmd: str, reply_max_size: int = 1024) -> str | None

Send a raw command to the scanner module.

acquire() -> bool

Move a card to the scanner and perform a scan.
If no card is in the printer, one is inserted from the tray.

get_image(type: ScanImage) -> bytearray | None

Retrieve a scanned image from memory (must call acquire() first).

ss = evolis.ScanSession(co)
if ss.acquire():
    img_bytes = ss.get_image(evolis.ScanImage.FRONT)
    with open("scanned_front.bmp", "wb") as f:
        f.write(img_bytes)

save_image(type: ScanImage, path: str) -> bool

Save a scanned image directly to a file.

ss.save_image(evolis.ScanImage.FRONT, "/output/card_front.bmp")

firmware_update(path: str) -> bool

Update the scanner module’s firmware.

get_last_error() -> ReturnCode

Get the error from the last method call.

Example

import evolis
 
evolis.ScanSession.set_library_path("/path/to/wsdef.so")
 
with evolis.Connection("Evolis Primacy") as co:
    ss = evolis.ScanSession(co)
    if ss.acquire():
        ss.save_image(evolis.ScanImage.FRONT, "/tmp/card_front.bmp")
        print("Scan saved")
    else:
        print("Scan failed:", ss.get_last_error())