Skip to Content
prasasti

Overview

Get the text out of PDFs and plain text files, in reading order, from Python, Node.js, Rust or the command line.

prasasti reads documents and gives you their text, one string per page, in the order a person would read it. You hand it a file, it works out the format from the bytes, and every format answers through the same Document API.

The smallest run

import prasasti

doc = prasasti.Document("report.pdf")
print(doc.format, doc.page_count)   # pdf 15
pages = doc.extract_text()          # list[str], one per page

The quick start installs it and walks through these lines.

What it reads

FormatWhat works
PDFText in reading order, page count, metadata, encrypted files (RC4, AES-128, AES-256), damaged files
Plain textUTF-8 and UTF-16 with or without a byte order mark, Windows-1252, form feeds as page breaks
DOCX, HTMLPlanned

Formats has the details for each one.

Where to go next

On this page