barkoder-wasm
v1.3.3
Published
Barkoder Barcode Scanner SDK for the Web
Downloads
126
Maintainers
Readme
barKoder Barcode Scanner Web SDK
Enterprise-grade barcode scanner SDK for the Web
The barKoder Barcode Scanner SDK will fully transform the user's smartphones and tablets that deploy your Enterprise and Consumer apps into rugged barcode scanning devices without the need to procure and maintain expensive and sluggish hardware devices that have a very short life span.
Even though the barKoder barcode scanner SDK is a relatively new product, it is already more advanced than other competitor API's. Its robust barcode reading engine can be used to read the content of the most widely used barcodes with lightning fast speed and unprecedented recognition rate:
1D - Codabar, Code 11, Code 25, Code 39, Code 93, Code 128, DotCode, EAN-8, EAN-13, Interleaved 2 of 5, ITF-14, MSI Plessey, Pharmacode, Telepen, UPC-A & UPC-E 2D - Aztec Code, Aztec Compact, Data Matrix, DotCode, PDF417, Micro PDF417, QR Code & Micro QR Code
The barKoder SDK features multiple algorithms that handle a wide variety of barcode scanning scenarios with unprecedented performance in terms of speed and success rate:
- DPM Mode - Specially designed scanning template for decoding Data Matrix barcodes engraved using any Direct Part Marking (DPM) technique;
- MatrixSight - Proprietary algorithm that can successfully scan QR Codes or Data Matrix barcodes even when they are missing their finder, timing and/or alignment patterns, even part of the data elements;
- Segment Decoding - The advanced barcode localization techniques implemented into the barKoder SDK grants an ability to recognize 1D barcodes that have significant deformations along their Z axis, getting especially handy when trying to recognize barcodes found on test tubes, bottles and other surfaces with rounded, curved, hollowed or otherwise irregular shapes;
- VIN Barcode Scanning Mode - The most advanced VIN barcode scanning mode on the market, utilizing all the special algorithms of the barKoder SDK leading to the ultimate scanning experience of any kind of barcodes used for embedding Vehicle Identification Numbers, including Code 39, Code 128, QR Code and Data Matrix;
- DeBlur Mode - Whether there's lens, motion or focus blur present in EAN or UPC barcodes, the barKoder DeBlur Mode alleviates it fully and doesn't allow the scanning experience to suffer;
- PDF417-LineSight - The robust PDF417 barcode scanner SDK that is offered by barKoder can detect even the most severely damaged PDF417 codes, including missing their start and stop patterns, stop row indicators or even entire data columns, making it the sublime choice for apps that need to reliably scan US or Canadian driver's licenses, South African vehicle license discs or driver's licenses, as well as various types of ID's such as Military, Argentinian, Colombian or South African Smart ID Cards.
- Batch MultiScan - The Batch MultiScan feature of the barKoder Barcode Scanner SDK for mobile apps and websites, will enable your users to decode multiple barcodes regardless of their type or size in one go. The barKoder API covers all common 1D and 2D barcode symbologies, enabling intuitive and fast data capture while delivering an accuracy of at least 99%, even under the most difficult scanning conditions. Whether in inventory counting, on the last mile or in manufacturing, our fast and accurate Batch MultiScan algorithm greatly increases efficiency and helps create friction-less internal and external processes. The Batch MultiScan works with smartphones, tablets and industrial cameras, enabling true mobility wherever it’s applied.
You can check out our free demo app Barcode Scanner by barKoder available both via Apple App Store & Google Play Store.
Trial License
If you run the barKoder Barcode Scanner SDK without a valid trial or production license, all results upon successful barcode scans will be partially masked by asterisks (*). You can get a trial license simply by registering on the barKoder Portal and utilizing the self-service for Evaluation License Generation! Each trial license will be good for an initial duration of 30 days and can be deployed to up to 25 devices. For any custom requirements, contact our sales team via [email protected]
Note that a trial license is only supposed to be utilized in a development or staging environment.
Free Developer Support
Our support is completely free for integration or testing purposes and granted through the barKoder Portal. After registering and logging into your account, you only need to submit a Support Issue form. Alternatively, you can contact us by email via [email protected].
Requirements
WebAssembly is a type of code that can be run in modern web browsers — it is a low-level assembly-like language with a compact binary format that runs with near-native performance and is designed to run alongside JavaScript. The following requirements need to be met:
- Client:
- Chrome 64+, Firefox 69+, Edge 79+, Safari 13.1+, iOS Safari 13.4+
- Camera usage permission (if using startScanner)
- Server:
- HTTPS, MIME type for wasm files
Install
npm install barkoder-wasm
Install Manually
If you would like to install from a local folder you will need to follow these steps:
- Download zip
- Unpack zip file
- Rename folder to your liking
- Paste the folder in app directory i.e. myApp/barkoder-wasm (this is the new name of the download module folder)
- Finally in your cli (within your app's directory):
npm install "./barkoder-wasm"
Using the SDK
Browser
Copy both barkoder-umd.js and barkoder.wasm to your page's directory.
Include the barkoder-umd.js script:
<script type="text/javascript" src="barkoder-umd.js"></script>
CommonJS
Copy barkoder.wasm to your page's directory (i.e. dist).
Require the UMD Module:
var BarkoderSDK = require('barkoder-wasm');
Then,
- In your js file:
async function barkoderInit () {
var Barkoder = await BarkoderSDK.initialize("your_license_key_here");
//enable symbologies you'd like to scan
Barkoder.setEnabledDecoders(
Barkoder.constants.Decoders.QR,
Barkoder.constants.Decoders.Ean8,
Barkoder.constants.Decoders.PDF417
);
//change any additional settings
Barkoder.setCameraResolution(Barkoder.constants.CameraResolution.FHD);
Barkoder.setDecodingSpeed(Barkoder.constants.DecodingSpeed.Normal);
}
barkoderInit(); //using await requires an async method
- In your HTML file add a div with barkoder-container id:
<div id="barkoder-container" style="width: 500px; height: 300px;"></div>
Additionally add style for size, position, background color, etc. Note that the container element needs to have a defined size, otherwise the SDK will set half the window size as fallback.
- Finally, you are ready to scan:
let callbackMethod = (result)=>alert(result.barcodeTypeName + '\n' + result.textualData);
Barkoder.startScanner(callbackMethod);
Barkoder.stopScanner();
Barkoder.scanImage('test.png', callbackMethod);
API
The initialize method must be called first. After it completes, it returns an object with the following members:
constants: object
startScanner(resultCallback?: function): number
stopScanner()
scanImage(imageUri: string, resultCallback?: function)
scanFromLocalFileSystem(input: string, resultCallback: function): void
setPauseDecoding(pause: boolean)
setRegionOfInterest(left: number, top: number, width: number, height: number)
setCameraResolution(cameraResolution: number)
getCameras(): Promise<object>
setCameraId(cameraId: string)
setFlashEnabled(flashEnabled: boolean): number
setZoomEnabled(zoomEnabled: boolean): number
setCloseEnabled(closeEnabled: boolean): number
setCameraPickerEnabled(cameraPickerEnabled: boolean): number
changeFlashState()
changeZoomState()
setContinuous(continuous: boolean): number
setDpsLimit(setDpsLimit: number)
setLocationLineColor(locationLineColor: string): void
setLocationLineWidth(locationLineWidth: number): void
setRoiLineColor(lineColor: string): void
setRoiLineWidth(lineWidth: number): void
setRegionOfInterestVisible(visible: boolean): void
setImageResultEnabled(enabled: boolean): void
setLocationInPreviewEnabled(enabled: boolean): void
configureBarkoder(barkoderConfig: BarkoderConfig)
applyTemplate(templateFile: string, templateMode: string)
setLengthRange(decoder: number, minimumLength: number, maximumLength: number)
setCode11ChecksumType(code11ChecksumType: number): number
setCode39ChecksumType(code39ChecksumType: number): number
setMsiChecksumType(msiChecksumType: number): number
setDatamatrixDpmModeEnabled(dpmModeEnabled: boolean): number
setEncodingCharacterSet(encodingCharacterSet: number)
setDecodingSpeed(decodingSpeed: number)
setFormatting(formatting: number)
setEnabledDecoders(...args: number)
setMulticodeCachingEnabled(multicodeCachingEnabled: number)
setMulticodeCachingDuration(multicodeCachingDuration: number)
setMaximumResultsCount(maximumResultsCount: number): number
setDuplicatesDelayMs(duplicatesDelayMs: number)
setUpcEanDeblur(deblur: number)
setEnableMisshaped1D(enableMisshaped1D: number)
setEnableVINRestrictions(enableVINRestrictions: number)
getVersion(): { barkoderWebVersion: string, barkoderVersion: string, barkoderFullVersion: string }
getRegionOfInterest(): { x:number, y:number, width: number, height: number }
getDecodingSpeed(): number
getFormatting(): number
getMaximumResultsCount(): number
getDuplicatesDelayMs(): number
getUpcEanDeblur(): number
getEnableMisshaped1D(): number
getEnableVINRestrictions(): number
getLocationLineColor(): string
getLocationLineWidth(): number
getRoiLineColor(): string
getRoiLineWidth(): number
isRegionOfInterestVisible(): boolean
isImageResultEnabled(): boolean
isLocationInPreviewEnabled(): boolean
setScannerTimeout(timeout: number): number
getContinuous(): boolean
getCameraResolution(): number
getEncodingCharacterSet(): number
getMsiChecksumType(): number
getCode39ChecksumType(): number
getCode11ChecksumType(): number
isBarcodeTypeEnabled(barcodeType: number): boolean
setBarcodeTypeEnabled(barcodeType: number, enabled: boolean): number
getBarcodeTypeLengthRange(barcodeType: number): [mix: number, max: number]
getMulticodeCachingEnabled(): number
getMulticodeCachingDuration(): number