Back to documentation

Document scanning

How Karchu validates an uploaded financial document, classifies it, extracts text, and falls back to OCR only when it has to.

Last updated 2026-09-11

Pipeline

upload
  -> validate (type, size, pages, readability)
  -> classify (statement, card statement, receipt, invoice, bill, expense report)
  -> extract text (PDF text layer first)
  -> OCR fallback (only when text is missing or unusable)
  -> parse transactions
  -> validate transactions
  -> categorize
  -> reconcile
  -> complete or requires_review

Karchu accepts a financial document, validates it, works out what kind of document it is, and extracts text before any parsing happens.

What this stage does

  • Validate the file type, size and page count before processing and return a specific error when a file cannot be read
  • Classify the document as a bank statement, credit card statement, receipt, invoice, bill, expense report or unknown, with a confidence score
  • Ask the user to confirm the document type when classification confidence is below 0.7
  • Read the PDF text layer first and only fall back to OCR when the text layer is missing or unusable
  • Preprocess photographed and scanned images: deskew, orientation correction, grayscale and contrast normalisation
  • Keep the uploaded original alongside the processed representation
  • Process every page of a multi page document, up to 300 pages
  • Record the processing state of each document: uploaded, validating, validated, extracting, ocr_processing, classifying, parsing, validating_transactions, requires_review, completed, failed

Accepted files

  • PDF (digital text layer)
  • PDF (scanned, image only)
  • PDF (multi page, up to 300 pages)
  • PNG
  • JPG and JPEG
  • HEIC where the browser can decode it
  • CSV
  • XLS and XLSX
  • ODS
  • TXT

Limits

  • Password protected PDFs are rejected with an explanatory error rather than guessed at
  • A photograph too blurred for OCR returns a low confidence result flagged for review, not invented text
  • HEIC support depends on the browser being able to decode the image

Processing states

Every document carries a state you can see in the app: uploaded, validating, validated, extracting, ocr_processing, classifying, parsing, validating_transactions, requires_review, completed, failed. Each state change is recorded with a timestamp, so an administrator can tell exactly where a document stopped and why.

Retries

A failed document can be reprocessed from the stored original. Attempt count, error and stage are tracked, and there is a hard limit of five server side attempts so a broken file cannot loop.

Questions

Does Karchu always run OCR?
No. A PDF with a usable text layer is read directly, which is faster and more accurate. OCR runs only when the text layer is missing or unusable, for example on a scan or a photograph.
What happens to a document Karchu cannot read?
It is marked failed with a specific reason, such as a password protected PDF, an empty page range or an image too low in resolution. The original file is kept and processing can be retried without uploading again.
How many pages can one document have?
Up to 300 pages. Every page inside that limit is processed.