Skip to main content

PageLedger: text from scanned documents, with a record of how each page was read

PageLedger: the tallied page

PyPI CI Python versions License DOI

PageLedger turns a scanned or born-digital document into text, one page at a time. For every page it keeps a record of how the text was read, and it lists the pages a person should look at before the text is trusted. Everything it writes is plain files in one folder: no service, no database.

It grew out of a Soviet census digitization project, and is written for historians, archivists and anyone else who has to say where a transcription came from.

Read a document

pageledger process book.pdf --out jobs/book

process reads each page's own text first (a born-digital PDF carries it), and sends the pages whose text is missing or looks wrong to an OCR engine on your machine: Tesseract, in English, unless you choose otherwise. It never calls a paid service unless you configure one. The folder jobs/book is the job: the record of everything done to this one document.

On three pages of an 1877 book scanned by the Internet Archive, the first blank and the others carrying the scan's earlier OCR, the screen shows:

Reading book.pdf: each page's own text, then Tesseract OCR in English for pages that need it. Nothing is sent anywhere.
Finished: 3 pages read; 3 need a person.
The job is in jobs/book.
Why they need a person:
  2 pages: the selected text is Tesseract OCR (eng); the PDF's own text (an earlier OCR), the only other reading, has words run together, so their comparison does not count and nothing confirms the selected text.
  1 page: no reading found text, or one came back empty: the page may be blank.
Next: pageledger review jobs/book shows those pages beside their page images for checking.
Text out: pageledger export jobs/book --out book.md

When something looks wrong on a page (text missing, an engine unsure of many words, two engines disagreeing), the job holds the page, and the screen says how many pages need a person and why: which reading, and what is wrong with it. Then:

  • pageledger inspect jobs/book shows the job's report, report.md: where each page stands and which reading was selected, then the record of how every page was read.
  • pageledger review jobs/book writes a review view into jobs/book-review to open in a browser: each page's image beside its text. Choose a decision for each page or correct its text there, and record the decisions with pageledger review jobs/book --apply ~/Downloads/review.json --reviewer "Your Name", naming the review.json the view downloaded where your browser saved it.
  • pageledger export jobs/book --out book.md writes the text out as plain text, Markdown, JSON lines or TEI, each page marked with whether a person has checked it.

The first job tutorial goes through these steps on a small example that needs no OCR engine.

What a source can be

A PDF, a UTF-8 text file (pages separated by form feeds), one JPEG or PNG page image, or a folder of them read as one document, pages in the order of their file names. pageledger fetch downloads an item's page images from a library's IIIF server into such a folder, with a record of where each image came from. See page images and fetching from IIIF.

Choosing an OCR engine

Tesseract reads many languages: name them with --lang in Tesseract's codes, such as rus or deu+eng (pageledger doctor lists the ones installed). For two other engines that run on your machine, RapidOCR and Indra, write a configuration with pageledger init --engine rapidocr (or indra) and pass it to process with --config. A job can also use a second engine, a vision model, or the OCR a library published with its scans (ALTO), to check the first reading. The OCR options compare the engines, non-English and historical OCR covers language packs and pre-reform spelling, and the engine recipes give a working setup for each.

Why a ledger

OCR makes mistakes that look like text, and a transcription that cannot be traced is hard to cite or correct. PageLedger records, for every page, which file it came from (by its SHA-256 hash), which engine read it with which settings, what each engine produced, why the page was held, and who reviewed or corrected it. pageledger verify jobs/book checks that the record is intact, here or after the job folder has been deposited elsewhere, so a reader of your edition can check any page against its source. It does not certify that the text is right: that is what review is for.

Runs: for building and testing pipelines

A job manages one document. The run commands (run, rerun, compare, classify, bundle, replay) apply one extraction tool to the pages of some files and record the same evidence; they are for building and testing a pipeline over many files. This example needs no OCR engine:

printf 'first page\fsecond page with a replacement character �\n' > sample.txt
pageledger init --run --out pageledger.yml
pageledger run sample.txt --config pageledger.yml --out runs/first
pageledger inspect runs/first
pageledger verify runs/first

The first run tutorial continues from here, and the CLI reference lists every command.

Install

PageLedger needs Python 3.10 or later. For PDFs, install the pdf extra:

pip install "pageledger[pdf]"
pageledger doctor

OCR also needs Poppler and Tesseract, installed separately: on macOS brew install poppler tesseract, on Debian or Ubuntu sudo apt-get install poppler-utils tesseract-ocr. pageledger doctor says which engines, tools and languages it finds. Jobs use POSIX file locks: use macOS, Linux or, on Windows, WSL.

The documentation is arranged by task.

Citing

Cite the software with CITATION.cff; share and cite results explains how to cite and deposit a job. Development setup is in CONTRIBUTING.md; report a bug or ask a question in the issues, and to report how PageLedger did on a collection, open a corpus report. A job, run or bundle someone sends you can name code to run: read folders you receive before resuming one, and report security problems privately as SECURITY.md explains.

MIT license.

Metadata

Release files for pageledger 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pageledger 0.9.0
File Size Uploaded Provenance Actions
pageledger-0.9.0.tar.gz 693.7 kB With provenance Details for pageledger-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pageledger 0.9.0
File Interpreter ABI Platform Actions
pageledger-0.9.0-py3-none-any.whl Python 3 none any Details for pageledger-0.9.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / pageledger-0.9.0.tar.gz

Download URL pageledger-0.9.0.tar.gz
Size 693.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7145b880ed8b27602d3cc92295690c1320d50275fc0864f8842b836b0777a22a
BLAKE2b-256 checksum
How to use checksums
5d464c8c7e4c775db535f84e5770a5c99977bd692907abaed47d8a4c7b3c6703
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / pageledger-0.9.0-py3-none-any.whl

Download URL pageledger-0.9.0-py3-none-any.whl
Size 413.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04e48e264a9286fe38b10fd8db543fca1ca3944a3b94a06a7c4c54ecd504716e
BLAKE2b-256 checksum
How to use checksums
c08e6eb7aeb83dd77fb5ac37b197906a49d9e9ada7135891e9dab8e9b7d8a6a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for pageledger 0.9.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pageledger-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page