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 pageThe quick start installs it and walks through these lines.
What it reads
| Format | What works |
|---|---|
| Text in reading order, page count, metadata, encrypted files (RC4, AES-128, AES-256), damaged files | |
| Plain text | UTF-8 and UTF-16 with or without a byte order mark, Windows-1252, form feeds as page breaks |
| DOCX, HTML | Planned |
Formats has the details for each one.
Where to go next
- You want it running: Quick start.
- You need every call in your language: Python, Node.js, Rust or the command line.
- You want to know why two columns and tables come out right: Reading order.
- You want the numbers: Benchmarks.