This native messaging host enables offline OCR processing of captured PDFs using OCRmyPDF with Apple Vision Framework for superior Japanese text recognition.
- macOS 11.0 or later (Apple Silicon or Intel)
- Python 3.9 or later
- Google Chrome browser
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install OCRmyPDF and Tesseract
brew install ocrmypdf tesseract tesseract-langcd native_host
# Install AppleOCR plugin and dependencies
pip3 install --user -r requirements.txtOr manually:
pip3 install --user ocrmypdf-appleocr./install_macos.shThis script will:
- Prompt for your Chrome extension ID
- Install the native messaging manifest
- Configure the host script
- Verify all dependencies are installed
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode" (toggle in top-right)
- Find "Auto Page Capture to PDF"
- Copy the 32-character ID shown below the extension name
After installation, verify everything works:
- Reload the extension in Chrome
- Open extension Options → OCR tab
- Should show "Dependencies OK" with version info
The host supports two OCR engines:
| Engine | Best For | Notes |
|---|---|---|
| Apple Vision (default) | Japanese, CJK languages | Uses macOS native OCR, better accuracy |
| Tesseract | Fallback option | Open-source, more language support |
| File | Description |
|---|---|
ocr_host.py |
Main native messaging host script |
install_macos.sh |
Installation script for macOS |
requirements.txt |
Python dependencies |
com.kindle_auto_reader.ocr_host.json |
Native messaging manifest template |
OCR processing logs are written to:
~/.kindle-auto-reader/ocr.log
-
Ensure Homebrew packages are installed:
brew install ocrmypdf tesseract tesseract-lang
-
Ensure Python packages are installed:
pip3 install --user ocrmypdf-appleocr
-
Re-run the install script:
./install_macos.sh
Check the log file for details:
cat ~/.kindle-auto-reader/ocr.logCommon causes:
- Python path issues (script updates shebang automatically)
- Missing dependencies in Chrome's restricted PATH
- Ensure you're using "Apple Vision" engine (not Tesseract)
- Apple Vision provides much better Japanese text recognition
To remove the native host:
rm ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.kindle_auto_reader.ocr_host.jsonTo also remove Python packages:
pip3 uninstall ocrmypdf-appleocr