Skip to content

pdfplumber

Python library that extracts text, characters, lines, rectangles and tables from PDFs.

Stars
10.9k
Forks
943
Licence
MIT
Language
Python
Last update
22 days ago
Type
Library

What it is

pdfplumber is a Python library and command-line tool for reading PDF files. It reports detailed position and style information for each text character, rectangle, and line on a page, and can pull out text and tables. It is built on the pdfminer.six parser and works best on PDFs generated by software rather than scanned images.

  • Export every character and its position from a PDF to CSV with the command line tool
  • Extract text from the first page of a PDF in a Python script
  • Pull tables out of a PDF page for further processing
  • Crop a page to a bounding box and extract text from only that region
  • Filter page objects by a custom test function before extracting

Great for

  • Python developers pulling tables or text out of machine-generated PDFs
  • Analysts who need to turn report PDFs into CSV or JSON
  • People who need exact coordinates of text or lines on a page
  • Anyone debugging why a PDF extraction looks wrong, using its visual debugging feature

Not ideal for

  • Scanned PDFs, since the README says it works best on machine-generated rather than scanned PDFs and does not describe OCR
  • Non-Python projects, since it is a Python library
  • People who only need to create or edit PDFs, since the README covers reading and extraction only
Step-by-step guide: how to use pdfplumberInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python 3.10 or newer (README lists tested versions 3.10 through 3.14)

    Install from PyPI

    pip install pdfplumber
  2. 2

    Run it

    • Install the package with pip install pdfplumber
    • Open a PDF in a Python script with pdfplumber.open("path/to/file.pdf")
    • Print the first character on the first page with print(first_page.chars[0])
    • Or run the pdfplumber command with a PDF path to write a CSV of objects
  3. 3

    Get the most out of it

    • Use the --format json option for page-level and PDF-level metadata as well as object data
    • Use --pages to limit output to specific pages or ranges
    • Pass laparams such as detect_vertical for layout analysis tuning
    • Use unicode_norm to pre-normalize text to NFC, NFD, NFKC or NFKD
    • Use the password argument to open password-protected PDFs

Downloads

Strengths

  • Exposes detailed per-object data such as characters, lines, rectangles and curves
  • Includes table extraction and visual debugging in one package
  • Has a simple Python API and a command line interface with CSV, JSON and text output

Trade-offs

  • The README says it works best on machine-generated PDFs, so scanned documents are a poor fit
  • Depends on pdfminer.six, so parsing quality follows that engine's limits
  • The README is truncated here, so details on table extraction settings are not covered in this entry

How it compares

ProjectStarsTypeLevelUpdatedBest for
pdfplumber (this)10.9kLibrarybeginner22 days agoPython developers pulling tables or text out of machine-generated PDFs
markitdown193kLibrarybeginner9 days agoDevelopers building LLM or text analysis pipelines that need document text
pdf-inspector19.8kLibraryintermediate14 days agoDevelopers building pipelines that process many PDFs and need to route scanned ones to OCR
docling70kLibrarybeginner5 days agoPython developers building retrieval or RAG pipelines over PDFs and office files
react-pdf16.8kLibraryintermediate6 days agoReact developers who need to generate PDF reports or invoices
zerox12.3kLibraryintermediate1.5 years agoDevelopers building pipelines that feed documents into AI or search systems

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.