• Public
  • Public/Protected
  • All

Class Scanner

A low-level scanner interacting with the external Scandit Engine library. Used to set up scan / image settings and to process single image frames.

The loading of the external Scandit Engine library which takes place on creation can take some time, the onReady method can be used to set up a listener function to be called when the library is loaded and the isReady method can return the current status. The scanner will be ready to start scanning when the library is fully loaded.

In the special case where a single Scanner instance is shared between multiple active BarcodePicker instances, the fairness in resource allocation for processing images between the different pickers is not guaranteed.


  • Scanner




  • new Scanner(__namedParameters?: object): Scanner
  • Creates a Scanner instance.

    It is required to having configured the library via configure before this object can be created.

    Before processing an image the relative settings must also have been set.

    If the library has not been correctly configured yet a LibraryNotConfiguredError error is thrown.

    If a browser is incompatible a UnsupportedBrowserError error is thrown.


    • Default value __namedParameters: object = {}
      • imageSettings: undefined | ImageSettings

        Default = undefined
        The configuration object to define the properties of an image to be scanned.

      • scanSettings: ScanSettings

        Default = new ScanSettings()
        The configuration object for scanning options.

    Returns Scanner



  • Applies a new set of image settings to the scanner (replacing old settings).


    • imageSettings: ImageSettings

      The image configuration object to be applied to the scanner.

    Returns Scanner

    The updated Scanner object.


  • Applies a new set of scan settings to the scanner (replacing old settings).


    • scanSettings: ScanSettings

      The scan configuration object to be applied to the scanner.

    Returns Scanner

    The updated Scanner object.


  • Create a new parser object.


    • dataFormat: DataFormat

      The format of the input data for the parser.

    Returns Parser

    The newly created parser.


  • destroy(): void
  • Stop the internal WebWorker and destroy the scanner itself; ensuring complete cleanup.

    This method should be called after you don't plan to use the scanner anymore, before the object is automatically cleaned up by JavaScript. The barcode picker must not be used in any way after this call.

    Returns void


  • isBusyProcessing(): boolean
  • Returns boolean

    Whether the scanner is currently busy processing an image.


  • isReady(): boolean
  • Returns boolean

    Whether the scanner has loaded the external Scandit Engine library and is ready to scan.


  • onReady(listener: function): Scanner
  • Add the listener function to the listeners array for the "ready" event, fired when the external Scandit Engine library has been loaded and the scanner can thus start to scan barcodes.

    No checks are made to see if the listener has already been added. Multiple calls passing the same listener will result in the listener being added, and called, multiple times.


    • listener: function

      The listener function.

        • (): void
        • Returns void

    Returns Scanner

    The updated Scanner object.


  • processImage(imageData: Uint8ClampedArray): Promise<ScanResult>
  • Process a given image using the previously set scanner and image settings, recognizing codes and retrieving the result as a list of barcodes (if any).

    Multiple requests done without waiting for previous results will be queued and handled in order.

    Depending on the current image settings, given imageData and scanning execution, any of the following errors could be the rejected result of the returned promise:

    • NoImageSettings
    • ImageSettingsDataMismatch
    • ScanditEngineError


    • imageData: Uint8ClampedArray

      The image data given as a byte array, complying with the previously set image settings.

    Returns Promise<ScanResult>

    A promise resolving to the ScanResult object.

Generated using TypeDoc