HEEx components that wire tesseract_js into a Phoenix layout.
Drop these into root.html.heex:
<TesseractJs.Component.preload />
<TesseractJs.Component.script />preload/1 hints the browser to start fetching tesseract.min.js and the
WASM core early. script/1 emits the <script> tags that load the upstream
tesseract.js, the wrapper bundle, and a small inline config block at
window.__tesseractJs.
Both components read :tesseract_js Application config and accept inline
overrides via attributes for per-page customization.
Summary
Functions
Renders <link rel="preload"> hints for the OCR assets.
Emits the <script> tags that load tesseract.js + the wrapper, and an inline
config block at window.__tesseractJs that the wrapper reads at boot.
Functions
Renders <link rel="preload"> hints for the OCR assets.
When preload_core: true (the default), also preloads the WASM core. Disable
this on pages where OCR is optional/lazy to avoid wasted bandwidth.
Attributes
base_path(:string) - Defaults tonil.preload_core(:boolean) - Defaults totrue.
Emits the <script> tags that load tesseract.js + the wrapper, and an inline
config block at window.__tesseractJs that the wrapper reads at boot.
All attrs are optional — defaults come from config :tesseract_js, ....
Attributes
base_path(:string) - Defaults tonil.lang(:string) - Defaults tonil.source(:atom) - Defaults tonil.Must be one ofnil,:cdn, or:local.tessdata_repo(:atom) - Defaults tonil.Must be one ofnil,:standard, or:best.core_variant(:atom) - Defaults tonil.Must be one ofnil,:simd_lstm,:simd, or:basic.defer(:boolean) - Defaults totrue.