> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt.
> For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Chain Digitise and Extract

> Improve extraction accuracy on messy scans and handwritten documents by digitising first, then running Extract over clean text.

For high-quality scans, a single **Extract** project pulls fields directly from the source. But for low-quality scans, historical documents, handwritten forms, or dense multilingual pages, chaining **Digitise → Extract** delivers noticeably higher accuracy.

The pattern: first digitise the document into clean structured text, then run an Extract Config over that clean text.

## When chaining is worth it

Digitise applies layout-aware cleanup before the Extract project ever sees the content.

Handwriting benefits from the Vision model's full attention on OCR, not field-finding.

Digitise handles Indic scripts; Extract works over the resulting clean text.

Multi-column pages, sidebars, and footnotes get flattened into natural reading order first.

For clean, printed English or single-language invoices, skip chaining. A direct Extract project is faster and just as accurate.

## The two-Config pattern

You'll build **two Configs** on the dashboard and run them as **two Projects** in sequence:

Cleans the source document into structured text.

Pulls your target fields from that clean text.

## Step 1: Build the Digitise Config

Follow [Digitise a document](/pages/how-to/digitise-a-document) to build a Digitise Config. Set:

**Handwritten** for manuscripts and forms, **Printed** for typeset documents.

The primary language of the source: **English**, **Hindi**, **Tamil**, and other supported languages.

Name it something clear like *Scan Cleanup* so teammates browsing configs know what it does. Save it.

## Step 2: Build the Extract Config

Follow [Extract structured fields](/pages/how-to/extract-structured-fields) to build an Extract Config. Copy this into **Describe what to extract**, then edit for your document type:

```text
Extract the invoice number, invoice date, vendor name, total amount, and GST ID from the clean invoice text.
```

Leave the output format on **Generate from prompt**. Name it *Invoice From Text* and save.

Add a hint to the Extract Config's description that reminds teammates it consumes Digitise output:

```text
Inputs are cleaned-up text from the Scan Cleanup Config.
```

## Step 3: Chain the two Projects

Open the **Scan Cleanup** Config, upload the messy scan, and click **Digitise**. Wait for the status to reach **Completed**.

Open the completed Digitise project. Either click **Download** to save the structured text, or copy the digitised text directly from the **Digitised text** tab.

Open the **Invoice From Text** Config. When it prompts for a document, paste the digitised text (or upload the exported text file). Give the project a name and click **Extract**.

Extracted values appear as a field-by-field table. Correct any that look off inline, then download as JSON, CSV, or Excel.

Both projects show up in **Workspace → Projects**. To keep them associated, use a consistent project-name prefix, e.g. *Acme-Invoice-Jun 4: Digitise* and *Acme-Invoice-Jun 4: Extract*.

## Compare accuracy before committing

Run the same 20 test documents through **both** approaches (direct Extract vs Digitise then Extract) and compare results inside the dashboard. Two things to check:

How many fields match your ground truth on each approach?

Chaining doubles the credit spend and roughly doubles processing time.

If chained-mode accuracy is meaningfully higher (say, 5%+), the extra step is worth it. If not, save the credits and stick with direct Extract.

## Trade-offs

Digitise cleans up layout, orientation, and OCR noise before extraction ever runs.

Roughly **2x credits** and **2x processing time** vs a direct Extract project.

For production, route documents by scan quality. High-quality scans go direct, low-quality scans go through the chain. You can automate this by tagging incoming documents on your side before uploading.

Next: [FAQs](/pages/faq).