llama-scan
A tool for converting PDFs to text files using Ollama or OpenRouter.
Features
- Convert PDFs to text files locally, no token costs.
- Use the latest multimodal models supported by Ollama and OpenRouter.
- Turn images and diagrams into detailed text descriptions.
Requirements
- Python 3.10+
- Ollama installed and running locally, unless you select another provider.
- An OpenRouter API key in
OPENROUTER_API_KEYwhen using--provider openrouter.
Installing Ollama and the Default Model
- Install Ollama
- Pull the default model:
ollama run qwen2.5vl:latest
Installation
Install using pip:
pip install llama-scan
or uv:
uv tool install llama-scan
Usage
Basic usage:
llama-scan path/to/your/file.pdf
Process specific pages:
llama-scan document.pdf --start 1 --end 5
Use a different model (Ollama):
llama-scan document.pdf --model qwen2.5vl:3b
Options
The following options can be used to customize PDF processing.
General
| Option | Description | Default |
|---|---|---|
--output, -o |
Directory where results are saved | output/ |
--start, -s |
First page to process | 0 |
--end, -e |
Last page to process | 0 |
Model configuration
| Option | Description | Default |
|---|---|---|
--provider, -p |
Transcription provider (ollama or openrouter) |
ollama |
--model, -m |
Model used for transcription | qwen2.5vl:latest (Ollama) |
--server-url, -u |
Ollama server URL | http://localhost:11434 |
--prompt |
Path to a text file that replaces the default transcription prompt |
Image processing
| Option | Description | Default |
|---|---|---|
--width, -w |
Resize images to the specified width (0 disables resizing) |
0 |
--dpi |
Resolution used when rendering PDF pages | 72 |
--keep-images, -k |
Keep intermediate image files | False |
Python API
In addition to the command-line interface (CLI), llama-scan can be used directly in Python scripts. This allows you to integrate PDF processing into your own applications and workflows.
from llama_scan import process_pdf
merged = process_pdf("document.pdf", "output")
print(merged.read_text(encoding="utf-8"))
Metadata
Release files for llama-scan 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llama_scan-0.2.0.tar.gz | 41.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_scan-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.9 kB
Release files / llama_scan-0.2.0.tar.gz
| Download URL | llama_scan-0.2.0.tar.gz |
|---|---|
| Size | 41.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
382caf6ece0cf1a444225c0129f53bc0e9238508b5e9ae9e90848b35bdb83998
|
|
BLAKE2b-256 checksum How to use checksums |
c65fda68f87f70946d761c0291cd6febe09d63bc295ee858b07ea27030a4745d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.11
|
Release files / llama_scan-0.2.0-py3-none-any.whl
| Download URL | llama_scan-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b21a6bf7e9b27560ed68d3d4ed97021a802a740c66131dd8aef513486728786
|
|
BLAKE2b-256 checksum How to use checksums |
bc04e93a76423150d8e6fc1db48cc7273546ad52288a662b3760404610ed3a8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.11
|
Security for llama-scan 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.