OCR — Images & PDFs
Extract text from images and PDF documents using pdftotext for digital PDFs and a vision model for scanned documents.
The lt-ocr pipeline extracts text from images and PDF documents. It uses a hybrid approach: fast native text extraction for digital PDFs and a vision model for scanned PDFs and raster images.
200 credits per file · ~3 minutes
Accepted Files
| Type | MIME types |
|---|---|
| Images | image/* (JPEG, PNG, WebP, TIFF, …) |
| Documents | application/pdf |
Up to 10 files per run.
Processing Logic
The pipeline selects the extraction method based on the file type and content:
- Digital PDFs —
pdftotextextracts embedded text directly. This is fast and accurate for PDFs generated from word processors or exported from applications. - Scanned PDFs — if
pdftotextyields fewer than 50 characters, the first page is rendered to an image and passed to a local Ollama vision model (default:llava) for OCR. - Images — always processed by the Ollama vision model directly.
The OCR model runs locally via Ollama. Results may vary depending on image quality and document layout complexity.
Context Parameters
None. This pipeline requires no additional context.
Output
{
"pipelineSlug": "lt-ocr",
"output": {
"extractedText": "Invoice\nDate: 2024-01-15\nAmount due: €1,250.00\n...",
"pageCount": 2,
"confidence": 0.91,
"model": "llava"
},
"rawText": "Invoice\nDate: 2024-01-15\nAmount due: €1,250.00\n..."
}Output Fields
| Field | Type | Description |
|---|---|---|
extractedText | string | All extracted text, preserving line breaks |
pageCount | number | null | Number of pages (PDFs only; null for images) |
confidence | number | null | Extraction confidence 0–1 (vision model only; null for pdftotext) |
model | string | Extraction method used ("pdftotext" or the Ollama model name, e.g. "llava") |
rawText | string | Alias of extractedText |
API Example
POST /v2/lt-pipelines/project/{projectId}/run{
"pipelineSlug": "lt-ocr",
"fileIds": ["file_abc123", "file_def456"],
"contextData": {}
}Response:
{
"runIds": ["ltrun_aaa111", "ltrun_bbb222"]
}Retrieve a result:
GET /v2/lt-pipelines/runs/ltrun_aaa111How is this guide?
Text Translation
Translate text files into any target language using an LLM.
Language Identification
Detect the language(s) present in text files or spoken in audio files.