@anyline/anyline-js
Advanced tools
Comparing version 29.0.2 to 29.1.1
{ | ||
"name": "@anyline/anyline-js", | ||
"version": "29.0.2", | ||
"version": "29.1.1", | ||
"description": "anyline sdk in the browser", | ||
"main": "anyline.js", | ||
"scripts": { | ||
"demo": "npx http-server -S -C cert/cert.pem -K cert/key.pem -P 3000" | ||
"demo": "npx http-server -S -C demo/cert/cert.pem -K demo/cert/key.pem --port 8443 -o /demo" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
142
README.md
# AnylineJS | ||
Anyline is a mobile OCR SDK, which can be customized to scan all kinds of numbers, characters, text and codes. | ||
[Anyline](https://www.anyline.com) 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](https://anyline.com/samples) | ||
Visit [js.anyline.com](https://js.anyline.com) for an official demo of AnylineJS. | ||
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). | ||
## Supported Usecases | ||
- Vehicle identification number (VIN), | ||
- shipping container (Horizontal and Vertical), | ||
- Barcode, | ||
- Serial number, | ||
- license plate, | ||
- MRZ, | ||
- EHIC (eCard), | ||
- german ID front (Beta), | ||
- austrian, german and UK drivers licenses (Beta) | ||
- meter scanning | ||
## Content | ||
- **anyline.js**: Main lib to self-host **AnylineJS** | ||
- **anylinejs**: Contains the files needed to self-host **AnylineJS** | ||
- **demo**: Contains **AnylineJS** implementation examples | ||
- **LICENSE**: The Third Party License Agreements | ||
- **README**: Information about the repository | ||
## Documentation | ||
For full documentation visit: [https://documentation.anyline.com/toc/platforms/javascript/index.html](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** | ||
To test Anyline download the Example Sheets with testing material: [https://anyline.com/samples](https://anyline.com/samples) | ||
# Install | ||
## Install | ||
`npm install @anyline/anyline-js` | ||
`import { init, errorCodes } from '@anyline/anyline-js` | ||
## Usage | ||
1. Copy the content of `anylinejs` to your webserver. In some cases you need to configure your webserver to serve `data` and `wasm.gz` files. | ||
or | ||
AnylineJS has to be served from a web server that supports HTTPS. | ||
2. Import AnylineJS | ||
copy the `anylinejs` folder into the public folder of your webapp. | ||
```JavaScript | ||
import { init } from '@anyline/anyline-js; | ||
``` | ||
import `anyline.js` via the script tag into your html | ||
Alternatively you can also directly import `anyline.js` using a script tag: | ||
`const { init, errorCodes } = window.anylinejs;` | ||
```HTML | ||
<script src="anyline.js"></script> | ||
``` | ||
# Usage | ||
This will expose anylinejs to the window scope: | ||
```javascript | ||
```JavaScript | ||
const { init } = 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', | ||
}, | ||
}, | ||
], | ||
}; | ||
3. Initialize AnylineJS | ||
const root = document.getElementById('root'); | ||
```JavaScript | ||
const Anyline = init({ | ||
preset: 'meter', // or id, ocr, eCard, ... | ||
viewConfig, | ||
license: anylicense, | ||
element: root, | ||
preset: 'meter', // id, ocr, eCard, ... | ||
license: 'add_your_license_key_here', | ||
// html container where anylineJS should be mounted to | ||
element: document.getElementById('root'), | ||
// location of the data files from step 1 (can also be an https link) | ||
anylinePath: '../anylinejs', | ||
}); | ||
``` | ||
Anyline.onResult = result => { | ||
let msg = JSON.stringify(result.result); | ||
alert(msg); | ||
}; | ||
4. Start scanning | ||
Anyline.onError = ({ code, message }) => { | ||
if (code === errorCodes.WEBCAM_ERROR) { | ||
console.error('webcam error: ', message); | ||
} | ||
//.... | ||
}; | ||
```JavaScript | ||
Anyline.startScanning().catch(console.error) | ||
``` | ||
Anyline.onLoad = () => { | ||
console.log('ANYLINE LOADED on main thread'); | ||
}; | ||
## Main-thread version | ||
Anyline.startScanning().catch(e => console.error(e.message)) | ||
``` | ||
The main-thread version is currently in beta and can be downloaded here (You can try to use it as a fallback for older devices): | ||
Download link -- https://js.anyline.com/beta/29.1_main/anylinejs.zip<br> | ||
CDN link -- https://js.anyline.com/beta/29.1_main/anyline.js | ||
## Try it locally | ||
`npm run demo` | ||
Visit https://127.0.0.1:8443/demo. The HTTPS server uses a self-generated certificate so you might need to bypass the security measures of your browser. | ||
**The license included in the demo only allows AnylineJS to run on 127.0.0.1 and localhost** | ||
## Available links: | ||
<br> | ||
Worker Demo link -- https://js.anyline.com/release/29.1/demo/index.html<br> | ||
Worker Archive link -- https://js.anyline.com/release/29.1/anylinejs.zip<br> | ||
Worker CDN link -- https://js.anyline.com/release/29.1/anyline.js<br> | ||
<br> | ||
Main Demo link -- https://js.anyline.com/beta/29.1_main/demo/index.html<br> | ||
Main Archive link -- https://js.anyline.com/beta/29.1_main/anylinejs.zip<br> | ||
Main CDN link -- https://js.anyline.com/beta/29.1_main/anyline.js<br> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
14544286
18
5667
109