talira

pdfplumber

Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables.

open sourceMITself-hostablefree

pdfplumber is an MIT-licensed Python library built on pdfminer.six that exposes every character, line, rectangle and curve on a PDF page with its exact coordinates and font, and provides customizable table extraction and layout-aware text extraction on top. Its visual debugging draws what it found onto a page image (handy in Jupyter) so you can tune table settings. It works best on machine-generated PDFs; it does not OCR, generate or modify PDFs.

Problems it solves

  • get the table on page 4 of a government report into a pandas DataFrame
  • copy-pasting tables out of PDFs into Excel breaks every column
  • I need the exact position and font size of each character on a PDF page
  • find the bounding box of the text 'Total due' so I can read the number to its right
  • crop a region of a PDF page and only extract the text inside it
  • see visually which lines and cells the table detector picked up so I can tune it
  • scrape hundreds of machine-generated bank statements into rows of transactions
  • extract text while keeping the page layout and column spacing
  • detect the ruling lines and rectangles that make up a form's boxes
  • dump every object on a PDF page to CSV or JSON from the command line

Features

  • per-character, line, rectangle and curve objects with coordinates
  • customizable table detection and extraction
  • layout-aware text extraction
  • visual debugging with page images (.to_image())
  • crop and filter objects by region
  • form field value extraction
  • CLI that outputs CSV, JSON or text
  • password-protected PDFs

Capabilities

Has a command line toolplan not known
Has official SDKsplan not known

Alternatives

The same job

These do what pdfplumber does.

  1. PyMuPDF A high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
  2. Docling Get your documents ready for gen AI
  3. Unstructured Converts PDFs, Office files, HTML and email into structured data for LLM pipelines
  4. pdf-reader A PDF parser conforming as much as possible to the PDF specification from Adobe
  5. Apache PDFBox The Apache PDFBox library is an open source Java tool for working with PDF documents.
  6. pypdfium2 Python bindings to PDFium, reasonably cross-platform

Compare pdfplumber with the top 3