OCR Online — Embed API

A client-side OCR component you embed in your app, like Stripe Elements. Documents never reach a server.

Try it

Pick an image or paste one from your clipboard. Recognition happens inside a hidden iframe pointing at /embed.html; this page never sees the pixel data after handing it over.

loading model…

      

Integration

Drop a hidden iframe in your page and import the SDK. The iframe runs OCR locally; your page calls recognize() like a normal async function.

<script type="module">
  import { OcrClient } from 'https://ocr.rotko.net/embed-client.js'

  const ocr = await OcrClient.attach('https://ocr.rotko.net/embed.html')
  const result = await ocr.recognize(file)   // File | Blob | ImageBitmap | ImageData
  console.log(result.text, result.items, result.avgConfidence)
</script>

What the embed does

Wire protocol

If you'd rather not use the SDK, the postMessage envelopes are tiny:

// parent → embed
{ type: 'ocr/recognize', id: number, blob | bitmap | imageData }

// embed → parent
{ type: 'ocr/hello',  version: 1 }      // on iframe load
{ type: 'ocr/ready' }                    // once models are cached
{ type: 'ocr/result', id, text, items, avgConfidence }
{ type: 'ocr/error',  id, error }