ngafar/llama-scan

Transcribe PDFs with local LLMs

What it solves

PDFs are often difficult to extract text from, especially when they contain images, diagrams, or scanned pages that don't have embedded text. llama-scan solves this by converting each PDF page into an image, then using a multimodal language model to transcribe the text and describe the visuals. This works either fully locally with Ollama (no token costs) or via OpenRouter if you want to use cloud-hosted models.

How it works

The tool renders PDF pages into images (at a configurable DPI and width), then sends those images to a chosen model—either a local model served by Ollama or a remote model via OpenRouter. The model returns text for that page, which is assembled into a single text file. You can specify which pages to process, choose different models, adjust image resolution, and even supply a custom prompt. A Python API is also available for embedding this functionality into your own scripts.

Who it's for

This is for people who need to extract readable text from PDFs that contain a mix of text and graphics, such as reports, scanned documents, or technical papers. It's also useful for developers who want to integrate PDF-to-text conversion into their Python applications using the provided API.

Highlights

  • Works locally with Ollama – no token costs, private, and free after setup.
  • Supports both local (Ollama) and cloud (OpenRouter) providers for flexibility.
  • Uses latest multimodal models to turn images and diagrams into detailed text descriptions.
  • Customizable: choose page ranges, model, image resolution, output folder, and even a custom prompt.
  • Offers a command-line interface and a Python function for integration.

Related

  • Project
  • Project
  • Project
  • Project