AnylineJS
Anyline is a mobile OCR SDK, which can be customized to scan all kinds of numbers, characters, text and codes.
AnylineJS is a standalone Anyline version for the browser.
Not included in the bundle are the Example Sheets with testing material. They can be downloaded here: https://anyline.com/samples
In its inital version the UI is hard wired into the SDK. Using custom user interfaces will be supported in the coming releases. AnylineJS has to be served from a web server that supports HTTPS. (Don't forget to add 'https://' if you are testing AnylineJS).
For full documentation visit: https://documentation.anyline.com/toc/platforms/javascript/index.html
The license included in the AnylineJS Repository only allows AnylineJS to run on 127.0.0.1
Install
copy the anylinejs
folder into the public folder of your webapp.
import anyline.js
via the script tag into your html
Usage
const { init, errorCodes } = window.anylinejs;
const viewConfig = {
outerColor: '000000',
outerAlpha: 0.5,
cutouts: [
{
cutoutConfig: {
maxWidthPercent: '80%',
alignment: 'top_half',
ratioFromSize: {
width: 300,
height: 250,
},
width: 720,
strokeWidth: 2,
cornerRadius: 4,
strokeColor: 'FFFFFFFF',
feedbackStrokeColor: '0099FF',
},
scanFeedback: {
style: 'contour_point',
strokeColor: '0099FF',
fillColor: '300099FF',
strokeWidth: 2,
cornerRadius: 4,
animationDuration: 150,
animation: 'NONE',
},
},
],
};
const root = document.getElementById('root');
const Anyline = init({
preset: 'meter',
viewConfig,
license: anylicense,
element: root,
anylinePath: '../anylinejs',
});
Anyline.onResult = result => {
console.log('Result: ', result);
let msg = JSON.stringify(result.result);
alert(msg);
};
Anyline.onError = ({ code, message }) => {
if (code === errorCodes.WEBCAM_ERROR) {
console.error('webcam error: ', message);
}
};
Anyline.onLoad = () => {
console.log('ANYLINE LOADED on main thread');
};
Anyline.startScanning().catch(e => console.error(e.message))
Demo
npm start demo
open https://127.0.0.1:8000/demo