How to use the react-native-tesseract-ocr.startOcr function in react-native-tesseract-ocr

To help you get started, we’ve selected a few react-native-tesseract-ocr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ricopella / splitz-ease / client / src / pages / grabReciept.js View on Github external
source = {
                        uri: response.uri,
                        isStatic: true
                    };
                } else {
                    source = {
                        uri: response
                            .uri
                            .replace('file://', ''),
                        isStatic: true
                    };
                }

                this.setState({imgSource: source});

                RNTesseractOcr
                    .startOcr(response.path, "LANG_ENGLISH")
                    .then((result) => {

                        const regex = /\d+.?\d*$/; //regex matching decimal value at end of line
                        let newResult = result;
                        console.log(newResult);

                        return newResult
                            .replace(/[|'"]+/g, '')
                            .split('\n')
                            .map(line => {
                                line = line.trim(); //trim whitespace
                                let index = line.search(regex); //returns index of beginning of match
                                return [
                                    line
                                        .substring(0, index)
github ricopella / splitz-ease / client / src / pages / App1.js View on Github external
source = {
                        uri: response.uri,
                        isStatic: true
                    };
                } else {
                    source = {
                        uri: response
                            .uri
                            .replace('file://', ''),
                        isStatic: true
                    };
                }

                this.setState({imgSource: source});

                RNTesseractOcr
                    .startOcr(response.path, "LANG_ENGLISH")
                    .then((result) => {
                        this.setState({ocrResult: result});
                        console.log("OCR Result: ", result);
                    })
                    .catch((err) => {
                        console.log("OCR Error: ", err);
                    })
                    .done();
            }
        });
    }
github jonathanpalma / react-native-tesseract-ocr / tesseractOcrSample / index.js View on Github external
}
      else if (response.customButton) {
        console.log('User tapped custom button: ', response.customButton);
      }
      else {
        var source;

        if (Platform.OS === 'android') {
          source = {uri: response.uri, isStatic: true};
        } else {
          source = {uri: response.uri.replace('file://', ''), isStatic: true};
        }

        this.setState({ imgSource: source });
        
        RNTesseractOcr.startOcr(response.path, "LANG_ENGLISH")
          .then((result) => {
            this.setState({ ocrResult: result });
            console.log("OCR Result: ", result);
          })
          .catch((err) => {
            console.log("OCR Error: ", err);
          })
          .done();
      }
    });
  }

react-native-tesseract-ocr

Tesseract OCR wrapper for React Native

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis