skillfed

pdftext

Extract structured text from pdfs quickly

pdftext v0.7.1 555.4K downloads/30d#6,027 on PyPI716
Permissive license Apache-2.0 Active released

What it is and what it does

PDFText is a Python library and CLI tool that extracts text from PDFs in plain-text or structured JSON format, grouping content into pages, blocks, lines, and spans with font metadata and bounding boxes. It wraps pypdfium2, a fast and accurate PDF rendering library, and offers an Apache-licensed alternative to PyMuPDF for extraction tasks that do not require AGPL compliance.

You can use it as a command-line tool to convert PDFs to text files or JSON, or call its extraction functions directly from Python code. It supports encrypted PDFs, page ranges, parallel extraction via process workers, and optional reading-order sorting. The library handles CJK, Cyrillic, Greek, and other left-to-right scripts correctly; right-to-left scripts are returned in the order pdfium reports them, which may differ from logical reading order.

Use it for:

  • Batch convert PDFs to plain text or JSON for downstream NLP and document analysis pipelines.
  • Extract structured block and line data with font info and bounding boxes for document layout analysis or OCR-free text mining.
  • Parse encrypted PDFs with password support in automated workflows.
  • Extract text from specific page ranges or use parallel workers to speed up extraction on large document collections.
  • Build a PDF text extraction service that avoids AGPL licensing constraints of PyMuPDF.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extracts plain text or structured blocks, lines, and spans from PDFs via a command-line tool or Python API, built on pypdfium2 with Apache licensing.

Yes. Active maintenance, low install friction, Apache licensing, no known vulnerabilities, and strong extraction accuracy (97.54% alignment vs. PyMuPDF on benchmarks) make this a solid choice for PDF text extraction. Install if you need structured extraction with font metadata, want to avoid AGPL, or prefer pypdfium2's architecture. Not suitable if you require right-to-left bidi reordering or need thread-safe extraction without process workers.

Install

pdftext on PyPI

pip

pip install pdftext

uv

uv add pdftext

poetry

poetry add pdftext

Installing pdftext

Before you install

Low friction: pure Python wheel with five runtime dependencies (click, numpy, pydantic, pydantic-settings, pypdfium2). Active maintenance, last commit 2026-07-08, 716 repository stars. Requires Python 3.10 or later.

License in practice

Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions—no copyleft obligations or AGPL concerns.

Quickstart

pip install pdftext

from pdftext.extraction import plain_text_output
text = plain_text_output('document.pdf', sort=False, hyphens=False)

Requires Python 3.10 or later. pypdfium2 is not thread-safe; use the built-in workers= option for parallelism or process pools, not threads.

Verify before relying

  • Whether the 97.54% alignment score vs. PyMuPDF holds across diverse real-world PDF types beyond the 200-document benchmark set.
  • Performance characteristics on very large PDFs (hundreds of pages) with the workers= option.
  • Completeness of right-to-left script handling compared to PyMuPDF's bidi reordering for Arabic and Hebrew documents.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4.0,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 5 — click, numpy, pydantic, pydantic-settings, pypdfium2
Maintenance actively maintained — 37 days since the last release
Last repo commit
First released
Downloads 555,402/month — #6,027 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pdftext-0.7.1-py3-none-any.whl

Keywords: pdf, text, extraction

License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

pdf text extractionextract text from pdfstructured pdf parsingpdf to text converterpdf content extractionpdf block and line extractionpypdfium2 wrapper
pdf-extractiontext-miningdocument-parsing

More Text Processing packages