Web SDK for barKoder - API Reference

The initialize method must be called first. After it completes, it returns an object with the following members: 

Api Reference#

startScanner(resultCallback?: function): number. #

Starts the scanner. This will access and start the camera, creates a preview to show the stream and adds it to a container element, and decode frames from it.

                startScanner: (resultCallback?: (result: Result) => void) => number
            

stopScanner(). #

Stops a previously started scanning session by startScanner.

                stopScanner: () => void
            

scanImage(imageUri: string, resultCallback?: function). #

Scans a single image.

                scanImage: (imageUri: string, resultCallback?: (result: Result) => void) => void | Promise<Result>
            

setPauseDecoding(pause: boolean). #

Pause the decoding.

                setPauseDecoding: (pause: boolean) => void
            

setRegionOfInterest(left: number, top: number, width: number, height: number). #

Set the desired region of interested. The decoder will only look at this area for barcodes.

                setRegionOfInterest: (left: number, top: number, width: number, height: number) => void
            
NameTypeDescription
leftnumberPercentage of the starting point on the x-axis of the preview.
topnumberPercentage of the starting point on the y-axis of the preview.
widthnumberPercentage of the width of the preview.
heightnumberPercentage of the height of the preview.

setCameraResolution(cameraResolution: number). #

Set the desired camera resolution.

Note that if device is not capable of providing the exact resolution, the closest available one will be used.

                setCameraResolution: (cameraResolution: CameraResolution) => number
            

getCameras(): Promise<object>. #

Get all available cameras from the device.

Note that this method may prompt the user for camera access permissions, if they are not already granted.

                getCameras: () => Promise<Cameras>
            

setCameraId(cameraId: string). #

Set the desired camera to use.The camera id previously obtained from getCameras.

                setCameraId: (cameraId: string) => void
            

setFlashEnabled(flashEnabled: boolean): number. #

Enable or disable flash button on camera preview. Default is enabled.

                setFlashEnabled: (flashEnabled: boolean) => number
            

setZoomEnabled(zoomEnabled: boolean): number. #

Enable or disable zoom button on camera preview. Default is enabled.

                setZoomEnabled: (zoomEnabled: boolean) => number
            

setCloseEnabled(closeEnabled: boolean): number. #

Enable or disable close button on camera preview. Default is enabled.

                setCloseEnabled: (closeEnabled: boolean) => number
            

setCameraPickerEnabled(cameraPickerEnabled: boolean): number. #

Enable or disable cameraPicker button on camera preview. Default is enabled.

                setCameraPickerEnabled: (cameraPickerEnabled: boolean) => number
            

changeFlashState(). #

Change i.e. toggle the current flash state.

Should be used only during an active scanning session. Outside of one, there is no effect.

                changeFlashState: () => void
            

changeZoomState(). #

Change i.e. cycle through the current zoom state.

Should be used only during an active scanning session. Outside of one, there is no effect.

                 changeZoomState: () => void
            

setContinuous(continuous: boolean): number. #

Enable or disable continuous scanning. Default is disabled.

                setContinuous: (continuous: boolean) => number
            

setDpsLimit(setDpsLimit: number). #

Set the desired decodes per second limit.

This setting affects how often the scanner will try to decode a frame. Higher values increase the likelihood of barcodes being detected faster, but is also more demanding on the device.

The DPS limit to apply. Default value is 2. Accepts values in the range of 1-30.

                setDpsLimit: (dpsLimit: number) => number
            

applyTemplate(templateFile: string, templateMode: string). #

Apply a set of pre-defined settings from a file.The template file in json format, containing settings for different template modes.

                applyTemplate: (templateFile: string, templateMode: string) => void
            

setLengthRange(decoder: number, minimumLength: number, maximumLength: number). #

Set the minimum and maximum length to be detected.

                setLengthRange: (decoder: Decoders, minimumLength: number, maximumLength: number) => number

            

setCode11ChecksumType(code11ChecksumType: number): number. #

Set checksum type for Code 11.

                setCode11ChecksumType: (code11ChecksumType: number) => number
            

setCode39ChecksumType(code39ChecksumType: number): number. #

Set checksum type for Code 39.

                setCode39hecksumType: (code39ChecksumType: number) => number
            

setMsiChecksumType(msiChecksumType: number): number. #

Set checksum type for MSI.

                setMsiChecksumType: (msiChecksumType: number) => number
            

setDatamatrixDpmModeEnabled(dpmModeEnabled: boolean): number. #

Enable Datamatrix dpm mode.

                setDatamatrixDpmModeEnabled: (dpmModeEnabled: boolean) => number
            

setEncodingCharacterSet(encodingCharacterSet: number). #

Set the character set to be used for encoding the results.

                setEncodingCharacterSet: (encodingCharacterSet: number) => void
            

setDecodingSpeed(decodingSpeed: number). setFormatting(formatting: number). #

Set the pace and effort at which the scanner will try to decode barcodes.The decoding speed to apply. Default is Normal.

                setDecodingSpeed: (decodingSpeed: DecodingSpeed) => number
            

setEnabledDecoders(...args: number). #

Set the decoders to enable.

Note that this method uses a rest parameter i.e. accepts an indefinite number of arguments.

                setEnabledDecoders: (...decoders: Decoders[]) => void
            

setFormatting#

Set the type of formatting to apply to results.Default is Disabled.

                setFormatting: (formatting: Formatting) => number
            

setMulticodeCachingEnabled(multicodeCachingEnabled: number). #

Enable or disable multicode caching. Default is Disabled.

                setMulticodeCachingEnabled: (multicodeCachingEnabled: number) => number
            

setMulticodeCachingDuration(multicodeCachingDuration: number). #

Set the duration for multicode caching.The duration in ms.

                setMulticodeCachingDuration: (multicodeCachingDuration: number) => number
            

setDuplicatesDelayMs(duplicatesDelayMs: number). #

Set the delay for duplicate results.

                setDuplicatesDelayMs: (duplicatesDelayMs: number) => number
            

setEnableVINRestrictions(enableVINRestrictions: number). #

Enable or disable VIN restrictions. Default is Disabled.

                setEnableVINRestrictions: (enableVINRestrictions: number) => number
            

getVersion(): { barkoderWebVersion: string, barkoderVersion: string, barkoderFullVersion: string }. #

Get the BarkoderSDK version details.

                getVersion: () => { barkoderWebVersion: string ; barkoderVersion: string ; barkoderFullVersion: string }

            

getRegionOfInterest(): { x:number, y:number, width: number, height: number }. #

Note that these values may be different during active scanning than the ones set by setRegionOfInterest.

Get the currently used region of interest.

                getRegionOfInterest: () => { x: number ; y: number ; width: number ; height: number }
            

setUpcEanDeblur(deblur: number).Enable or disable deblur. Default is Disabled.#

                setUpcEanDeblur: (deblur: number) => number
            

setEnableMisshaped1D(enableMisshaped1D: number).#

Enable detection of misshaped 1D barcodes.

                setEnableMisshaped1D: (enableMisshaped1D: number) => number
            

getDecodingSpeed(): number. getFormatting(): number. getDuplicatesDelayMs(): number. #

Get the decoding speed.

                getDecodingSpeed: () => DecodingSpeed
            

getUpcEanDeblur(): number. #

Get the UPC/EAN deblur state.

                getUpcEanDeblur: () => number
            

getEnableVINRestrictions(): number#

Get the VIN restrictions state.

                getEnableVINRestrictions: () => number
            

getEnableMisshaped1D(): number.#

Get the misshaped 1D state.

                getEnableMisshaped1D: () => number
            

getLocationLineColor(): string. #

                getLocationLineColor: () => string
            

Retrieves the color code representing the line color used to indicate the location of detected barcodes.

getLocationLineWidth(): number. #

                getLocationLineWidth: () => number
            

Retrieves the current width setting for the lines indicating the location of detected barcodes on the camera feed.

getRoiLineColor(): string. #

                getRoiLineColor: () => string
            

Retrieves the color code representing the line color of the Region of Interest (ROI) on the camera preview.

getRoiLineWidth(): number. #

                getRoiLineWidth: () => number
            

Retrieves the current width setting for the lines outlining the Region of Interest (ROI) on the camera preview.

isRegionOfInterestVisible(): boolean. #

                isRegionOfInterestVisible: () => boolean
            

Checks if the region of interest (ROI) is visible.

isImageResultEnabled(): boolean. #

                isImageResultEnabled: () => boolean
            

Checks if the inclusion of the captured frame in the result is enabled.

isLocationInPreviewEnabled(): boolean#

                isLocationInPreviewEnabled: () => boolean
            

Check if the location in the preview is enabled.

Page Contents

History:

close