In one of my recent project I had to develop one SPA to read MRZ code of passport. There are many software and libraries available for optical character recognition. After bit of study I chose Tesseract.js library, which is quite powerful and easy to use.
In this tutorial I just want to share some sample code, which may helpful to others. By hosting this page in any web-server, you can scan any document (by webcam of desktop or phone camera) and read text within that.
Demo Link — https://indusx.github.io/demo/ocr.html
Sample output —