|
| 1 | + |
1 | 2 | # vision-camera-dynamsoft-barcode-reader
|
2 | 3 |
|
3 |
| -React Native Vision Camera Frame Processor Plugin of Dynamsoft Barcode Reader |
| 4 | +React Native Vision Camera Frame Processor Plugin of [Dynamsoft Barcode Reader](https://www.dynamsoft.com/barcode-reader/overview/). |
| 5 | + |
| 6 | +## Versions |
| 7 | + |
| 8 | +For vision-camera v2, use versions 0.x. |
| 9 | + |
| 10 | +For vision-camera v3, use versions 1.x. |
| 11 | + |
| 12 | +For vision-camera v4, use versions >= 2.0.0. |
4 | 13 |
|
5 | 14 | ## Installation
|
6 | 15 |
|
7 | 16 | ```sh
|
8 |
| -npm install vision-camera-dynamsoft-barcode-reader |
| 17 | +yarn add vision-camera-dynamsoft-barcode-reader |
| 18 | +cd ios && pod install |
9 | 19 | ```
|
10 | 20 |
|
| 21 | +Add the plugin to your `babel.config.js`: |
| 22 | + |
| 23 | +```js |
| 24 | +module.exports = { |
| 25 | + plugins: [['react-native-worklets-core/plugin']], |
| 26 | + // ... |
| 27 | +``` |
| 28 | +
|
| 29 | +> Note: You have to restart metro-bundler for changes in the `babel.config.js` file to take effect. |
| 30 | +
|
11 | 31 | ## Usage
|
12 | 32 |
|
| 33 | +1. Scan barcodes with vision camera. |
| 34 | + |
| 35 | + ```js |
| 36 | + import { decode } from 'vision-camera-dynamsoft-barcode-reader'; |
| 37 | + |
| 38 | + // ... |
| 39 | + const frameProcessor = useFrameProcessor((frame) => { |
| 40 | + 'worklet'; |
| 41 | + const barcodes = decode(frame); |
| 42 | + }, []); |
| 43 | + ``` |
| 44 | + |
| 45 | +2. Scan barcodes from a base64-encoded static image. |
| 46 | +
|
| 47 | + ```ts |
| 48 | + let results = await decodeBase64(base64); |
| 49 | + ``` |
| 50 | +
|
| 51 | +3. License initialization ([apply for a trial license](https://www.dynamsoft.com/customer/license/trialLicense/?product=dbr)). |
| 52 | +
|
| 53 | + ```ts |
| 54 | + await initLicense("your license"); |
| 55 | + ``` |
| 56 | +
|
| 57 | +### Interfaces |
| 58 | +
|
| 59 | +TextResult: |
| 60 | +
|
13 | 61 | ```js
|
14 |
| -import { multiply } from 'vision-camera-dynamsoft-barcode-reader'; |
| 62 | + TextResult{ |
| 63 | + barcodeText:string; |
| 64 | + barcodeFormat:string; |
| 65 | + barcodeBytesBase64:string; |
| 66 | + x1:number; |
| 67 | + x2:number; |
| 68 | + x3:number; |
| 69 | + x4:number; |
| 70 | + y1:number; |
| 71 | + y2:number; |
| 72 | + y3:number; |
| 73 | + y4:number; |
| 74 | +} |
| 75 | +``` |
15 | 76 |
|
16 |
| -// ... |
| 77 | +Configuration: |
17 | 78 |
|
18 |
| -const result = await multiply(3, 7); |
| 79 | +```js |
| 80 | +DBRConfig{ |
| 81 | + template?:string; |
| 82 | + license?:string; |
| 83 | + isFront?:boolean; |
| 84 | + rotateImage?:boolean; |
| 85 | +} |
19 | 86 | ```
|
20 | 87 |
|
| 88 | +`isFront` and `rotateImage` are Android-only. Since the natural camera sensor's orientation in Android is landscape, the camera image may be rotated for preview while the raw image we get is still not rotated. If we enable `rotateImage`, the plugin will rotate the image automatically to match the camera preview. If it is disabled, the plugin will rotate the returned coordinates instead of the image which may have a slight performance gain. `isFront` is needed for rotating the coordinates since the image of front camera is mirrored. |
| 89 | +
|
| 90 | +## Supported Platforms |
| 91 | +
|
| 92 | +* Android |
| 93 | +* iOS |
| 94 | +
|
| 95 | +## Supported Barcode Symbologies |
| 96 | +
|
| 97 | +* Code 11 |
| 98 | +* Code 39 |
| 99 | +* Code 93 |
| 100 | +* Code 128 |
| 101 | +* Codabar |
| 102 | +* EAN-8 |
| 103 | +* EAN-13 |
| 104 | +* UPC-A |
| 105 | +* UPC-E |
| 106 | +* Interleaved 2 of 5 (ITF) |
| 107 | +* Industrial 2 of 5 (Code 2 of 5 Industry, Standard 2 of 5, Code 2 of 5) |
| 108 | +* ITF-14 |
| 109 | +* QRCode |
| 110 | +* DataMatrix |
| 111 | +* PDF417 |
| 112 | +* GS1 DataBar |
| 113 | +* Maxicode |
| 114 | +* Micro PDF417 |
| 115 | +* Micro QR |
| 116 | +* PatchCode |
| 117 | +* GS1 Composite |
| 118 | +* Postal Code |
| 119 | +* Dot Code |
| 120 | +
|
21 | 121 | ## Contributing
|
22 | 122 |
|
23 | 123 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
24 | 124 |
|
25 | 125 | ## License
|
26 | 126 |
|
27 | 127 | MIT
|
28 |
| - |
29 |
| ---- |
30 |
| - |
31 |
| -Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) |
|
0 commit comments