Passport MRZ reading with Tesseract.js OCR library

Devesu
1 min readMay 30, 2019

--

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.

Credit: https://www.canada.ca/en/immigration-refugees-citizenship/corporate/publications-manuals/operational-bulletins-manuals/identity-management/naming-procedures/read-travel-documents.html

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 —

--

--