Quick start
Install prasasti, open a file and get its text, in Python, Node.js, Rust or the command line.
Install it
pip install prasasti
# or
uv add prasastiWheels ship for Linux, macOS and Windows, so there's nothing to compile.
Open a file and get its text
import prasasti
doc = prasasti.Document("report.pdf")
print(doc.format) # "pdf"
print(doc.page_count) # 15
first = doc.page_text(0)
pages = doc.extract_text()Pages are numbered from 0. A plain text file works the same way, so notes.txt in place of report.pdf needs no other change.
Use every core for big files
Pages don't depend on each other, so prasasti can read them in parallel. Pass 0 threads to use every core.
pages = doc.extract_text(threads=0)A password-protected PDF
Pass the password when you open the file. Files with an empty user password open without one.
doc = prasasti.Document("locked.pdf", password="secret")All the text as one string
Each binding has a shortcut that joins the pages with a form feed (\f), the same separator pdftotext uses.
text = prasasti.extract_text("report.pdf")
pages = text.split("\f")