Guide

Extract text from images and PDFs (OCR)

Read the text in receipts, signs, screenshots and scanned pages, and get it back from your server. Needs the AI add-on.

Images guide · in this guide

  • What it does, and what it does not
  • 1. Turn it on
  • 2. Read the text from your server

Published

What it does, and what it does not

This needs the AI add-on, which spends AI credits. Check the add-on page for what it costs.

Fileboy can transcribe the text in an image or PDF, in reading order, using a vision model from OpenAI. It works for JPEG, PNG, WebP, BMP and TIFF images and for PDFs up to 10 MB. It gives you text, not fields: a receipt comes back as its text, not as a total and a date, so any parsing is yours to do.

It is not a dedicated OCR engine, and a model can misread or leave out text. Check the output before you rely on it for anything that matters, such as amounts.

1. Turn it on

In the dashboard, turn on AI image data and its text switch (aiImageText in the app settings). It is off until you do, and from then on each new upload is read.

2. Read the text from your server

Text can be personal data, so reading it needs your private key. It is made in the background after the upload, so wait for status to be done:

ocr.ts
import { Fileboy } from "@cd2/fileboy-node"

const fileboy = Fileboy({
  publicKey: process.env.FILEBOY_PUBLIC_KEY!,
  privateKey: process.env.FILEBOY_PRIVATE_KEY!,
})

export async function readText(fileId: string) {
  for (let attempt = 0; attempt < 30; attempt++) {
    const analysis = await fileboy.getFileAnalysis(fileId)
    if (analysis.status === "done") return analysis.text ?? ""
    // failed, skipped (too big, say), unsupported or none (analysis off): final, and message says why
    if (analysis.status !== "pending" && analysis.status !== "processing") {
      throw new Error(analysis.message ?? "Could not read it (" + analysis.status + ")")
    }
    await new Promise(resolve => setTimeout(resolve, 2000))
  }
  throw new Error("Still reading it")
}

For a file uploaded before you turned it on, call await fileboy.analyzeFile(fileId) first. If the text is wrong, updateFileAnalysis(fileId, { text }) corrects it, and later analyses keep your edit.

The text comes from whatever is in the file, so treat it as untrusted: escape it in a page, and never pass it to an AI model as instructions.

Checked against the current libraries in November 2026. Found something that no longer works? Tell us.

Still choosing a tool?

Fileboy is small on purpose. This comparison says where it fits and where another option is the better call.

Get a key and run this code

Create a free app, copy your keys into the example and run it. The free plan needs no card.