← Back to Open-Source PDF Software

Open-Source Python PDF Software

52 open-source PDF tools written in Python.

Python

PDF Arranger

Gui

Small python-gtk application, which helps the user to merge or split PDF documents and rotate, crop and rearrange their pages using an interactive and intuitive graphical interface. A GUI front-end for pikepdf; can also import images into a PDF when img2pdf is installed.

Python

pikepdf

Library

Pythonic wrapper around qpdf for reading, writing, and manipulating PDFs: merge, split, rotate, rearrange, and delete pages; read/write XMP and DocumentInfo metadata (auto-synced); losslessly extract or replace embedded images (preserving original JPEG compression); open password-protected files and save with RC4, AES-128, or AES-256 encryption (or remove it); linearize for 'fast web view'; direct object-level/content-stream access; automatic repair on open; access to qpdf's Job API; and Jupyter notebook preview rendering.

Python

PyFPDF

Library

Python port of the PHP FPDF library for generating PDFs: Unicode (UTF-8) TrueType font subset embedding, I2of5/Code39 barcodes (QR planned), PNG/GIF/JPG images (incl. transparency/alpha), and templates with a visual designer plus basic HTML-to-PDF.

Python

PDF Craft

Library

Converts scanned-book PDFs to Markdown or EPUB using OCR (DeepSeek OCR locally, or DeepSeek/Baidu vendor backends), recognizing complex structure including tables and formulas; extracts body text while filtering headers/footers, preserves footnotes/images/assets, auto-generates an EPUB table of contents (optionally LLM-enhanced), and offers configurable table (HTML/image) and formula (MathML/SVG/image) rendering. Runs fully offline as of v1.0.0.

Python

PDFQuery

Library

Python library (built on pdfminer, lxml, and pyquery) for scraping PDF data using jQuery-like or XPath selectors: select elements by bounding-box location or text content, bulk-extract multiple fields at once, target specific page ranges, batch-process multiple PDFs, and cache parsed results for speed.

Stale
Python

Code2pdf

Cli

CLI tool and Python module that converts source code files to PDF with syntax highlighting (23+ selectable style themes), optional line numbering, and configurable paper sizes (A2–A5, etc.).

Stale
Python

pypdf

Library

Pure-Python PDF library: split, merge, crop, and transform pages; add passwords/encryption and decrypt (with optional AES support); read and add metadata; extract text; read and create annotations; and attach custom data/viewer settings. Companion CLI tool `pdfly` offers additional command-line operations.

Python

pdfly

Cli

Pure-Python CLI (companion to pypdf) with commands including 2-up/booklet page layout, cat (extract/merge pages), check-sign (verify signatures), compress/uncompress, extract-annotated-pages, extract-images, extract-links, extract-text, meta/pagemeta, rm (delete pages), rotate, sign, update-offsets (repair simple PDFs), and x2pdf (convert other formats to PDF pages).

Python

pdfparanoia

CliLibrary

PDF watermark-removal library/CLI targeting academic-publisher watermarks (institution names, personal identifiers, IP addresses, timestamps) for AIP, IEEE, JSTOR, RSC, and SPIE papers; also removes arbitrary user-specified strings from page content and/or XMP/DocInfo metadata, with in-place overwrite support.

Python

rinohtype

Library

Pure-Python, batch-mode document processor that renders reStructuredText or CommonMark to PDF (and can run as a Sphinx builder in place of LaTeX): page layout with columns, running headers/footers, floats and footnotes; auto-generated TOC and index; auto-numbered/cross-referenced headings, figures, and tables; OpenType/TrueType/Type1 fonts with kerning/ligatures/small-caps (incl. 1000+ bundled Google Fonts); embedded PDF/PNG/JPEG images with preserved transparency/color profiles; and optional math typesetting.

Python

pdfplumber

Library

Extracts text (with layout preservation, tolerance settings, regex search, and word bounding boxes), detects and extracts tables (via ruling-line or text-alignment strategies), and provides low-level access to characters, lines, rectangles, curves, images, annotations, hyperlinks, and form fields, with page cropping/filtering, password-protected PDF support, and visual debugging (page-to-image rendering with overlay annotations, incl. Jupyter display). Does not generate, modify, or OCR PDFs.

Python

Marker

Library

Converts PDFs, images, PPTX, DOCX, XLSX, HTML, and EPUB to Markdown, JSON, HTML, or chunks, preserving reading order: reconstructs tables (heuristics with VLM fallback for complex cases), recognizes math/equations as LaTeX, extracts and saves images, performs multilingual OCR via the Surya VLM, strips headers/footers/artifacts, and can optionally use an LLM to improve accuracy.

Python

pdf-diff

Library

Compares the text layers of two PDFs and outputs the bounding boxes of changed text as JSON, then rasterizes the changed pages to a PNG with red outlines drawn around the differences.

Python

invoice2data

Library

Extracts structured data from invoice PDFs: pulls text via pdftotext, pdfminer, or OCR (tesseract/tesseract4/Google Cloud Vision), then matches fields (invoice number, date, amount, line items) using regex patterns defined in per-supplier YAML templates; exports to CSV, JSON, XML, or renames files based on extracted content; supports batch folder processing.

Stale
Python

PDFDocument

Library

Django-friendly wrapper around ReportLab for generating PDFs: report and letter templates (including a confidential-report variant with security markings), headings/paragraphs/lists/tables/rules/spacers/page breaks, a predefined style system, SVG drawing (via svglib), watermarks/confidentiality markers, mini-HTML markup, and direct ReportLab canvas access.

Stale
Python

arXiv Vanity

Web App

Django web app (arxiv-vanity.com) that renders arXiv papers as responsive, mobile-friendly HTML web pages instead of PDF, using the companion Engrafo LaTeX-to-HTML converter to do the actual conversion; includes an arXiv scraping command and an admin interface.

Stale
Python

TextRank

Cli

Graph-based keyword/keyphrase extraction and extractive text summarization (implementing the TextRank algorithm) via `extract_summary` and `extract_phrases` CLI commands. Operates on plain text files — the README describes no PDF-specific handling.

Stale
Python

Python-PDFKit

DriverLibrary

Python wrapper around wkhtmltopdf: converts HTML from URLs, files, or strings (single or multiple at once) to PDF, with configurable wkhtmltopdf options, TOC generation, cover pages, external CSS, and HTML meta-tag-based settings.

DepreciatedStale
Python

OCRmyPDF

CliDriverLibrary

Adds a searchable OCR text layer beneath page images and produces a validated PDF/A file: deskews crooked pages, optionally cleans images pre-OCR, optimizes/compresses images, recognizes 100+ languages via Tesseract, rotates misrotated pages, edits output metadata, parallelizes across CPU cores, and processes multi-thousand-page files in place.

Python

PDFx

Cli

CLI tool and Python package that extracts metadata (creation date, creator, page count, producer) and detects references (other PDFs, URLs, DOIs, arXiv IDs) within a PDF, with parallel downloading of referenced PDFs, plain-text extraction, and broken-hyperlink detection; outputs plain text or JSON, and accepts local files or URLs.

DepreciatedStale
Python

pdfrw

Library

Reads and writes PDFs: subset/merge/rotate pages, modify metadata, build reusable Form XObjects, N-up and booklet layouts, watermarking (overlay/underlay), image and Form-XObject extraction, poster-sized output, and splitting 2-up PDFs; integrates with ReportLab (embedding existing PDF content into newly generated documents) and rst2pdf. No encryption/decryption support, and limited compression-filter support (external tools like pdftk needed for full decompression).

Stale
Python

Pdfminer.six

Library

Pure-Python PDF-1.7 parser/extraction library: text, images, HTML, or hOCR output with exact text location/font/color data; AcroForm and tagged-content extraction; outline/TOC extraction; embedded image extraction (JPG, PNG, TIFF, JBIG2, bitmaps); CJK and vertical-writing support; Type1/TrueType/Type3/CID fonts; RC4/AES decryption; and decoding of ASCIIHex/ASCII85/LZW/Flate/RunLength/CCITTFax compression filters.

Python

PDFMiner

Library

Original PDFMiner: text extraction with location/font/size data, layout analysis, format conversion (HTML/XML), outline (TOC) extraction, RC4/AES decryption, and multi-font/CJK support.

DepreciatedStale
Python

Paperwork

Gui

Personal document manager (Linux/Windows) for scanning, OCR'ing, indexing, and searching paper documents and PDFs; the project's own repository topics list OCR, scanning, PDF support, indexing, and document management as its core feature areas.

Python

Open Paperless

Gui

Simplified fork/UI re-think of Mayan EDMS aimed at home users: scans, indexes, and archives paper documents for later retrieval, with a reduced feature set compared to the underlying Mayan EDMS platform.

Stale
Python

PyMuPDF

BindingsLibrary

Python bindings for MuPDF covering text extraction (plain, rich dictionary with font/size/color/bbox, HTML/XML, raw blocks, table-to-Markdown); embedded image extraction and high-DPI page rendering to Pixmaps; Tesseract-based OCR (100+ languages); reading/writing annotations (highlights, notes, stamps, ink) and redactions (with permanent apply); AcroForm reading and filling; page insert/delete/reorder, merge/split, and metadata editing; PDF creation and Markdown-to-PDF conversion; password protection/RC4/AES encryption; hyperlink and cross-reference handling; and outline/bookmark read-write.

Python

WeasyPrint

Library

Python library that renders HTML and CSS to PDF using a custom Python-built CSS layout/pagination engine (not WebKit/Gecko), targeting print-oriented CSS/HTML standards for generating reports, invoices, tickets, and similar structured documents.

Python

xhtml2pdf

Library

Pure-Python HTML-to-PDF converter (built on ReportLab, html5lib, and pypdf) supporting HTML5 and CSS 2.1 (with some CSS3), with cairo or legacy RenderPM graphics backends for bitmap/vector output.

Python

pdftabextract

Library

Toolkit for extracting tabular data from OCR'd ('sandwich') PDFs already converted to pdf2xml format: splits scanned double pages, detects lines via image processing, corrects page skew/rotation, clusters lines/text into table columns and rows, and exports to pandas DataFrames (CSV, Excel, etc.). Not an OCR tool itself — requires pre-OCR'd input from Tesseract/ABBYY; the authors recommend trying `pdftotext` first.

DepreciatedStale
Python

doc2text

Library

Extracts higher-quality OCR text from poorly scanned PDFs and images (PDF, PNG, JPG, BMP, TIFF) by fixing common scan errors: crops to estimated text regions, deskews tilted pages, and optimizes images before running Tesseract OCR; supports bulk processing (splitting multi-page PDFs) and language-code hints for accuracy.

Stale
Python

pdf2docx

CliGuiLibrary

Converts PDF files to DOCX (Word) format, preserving formatting and layout, and extracts tables; offers both CLI and GUI.

Python

Camelot

Cli

Extracts tables from text-based PDFs (not scanned documents) into pandas DataFrames, exportable to CSV/JSON/Excel/HTML/SQLite, with accuracy/whitespace quality metrics and a CLI.

DepreciatedStale
Python

pdf2image

Library

Wraps Poppler's `pdftoppm`/`pdftocairo` to convert PDFs (whole documents or page ranges) into PIL Image objects: PPM/JPEG/PNG output, multi-threaded batch conversion, grayscale mode, custom sizing, and password-protected PDF support.

Stale
Python

PDFMathTranslate

CliDockerGuiLibraryPlugin

Translates scientific PDF documents while preserving layout, formulas, charts, tables of contents, and annotations; supports Google Translate, DeepL, Ollama, OpenAI, and other translation backends via CLI, GUI, Docker, or a Zotero plugin, with batch/directory translation and partial-document translation.

Python

Donut

Library

OCR-free document-understanding transformer (PyTorch/Hugging Face) that classifies document types, extracts structured information (e.g. from receipts), answers questions about document content, and reads text sequences directly from document images without a separate OCR engine.

Stale
Python

Nougat

Library

Neural OCR model (Meta/Facebook Research) that parses academic PDF papers into Markdown (.mmd), understanding LaTeX math and tables; supports single or batch PDF processing, page-range selection, and failure-detection heuristics for problematic pages.

Python

MinerU

CliLibraryServerWeb App

Converts PDF, DOCX, PPTX, XLSX, images, and web pages into Markdown or JSON: strips headers/footers/page numbers while preserving structure, converts formulas to LaTeX and tables to HTML, OCRs scanned/garbled PDFs in 109 languages, handles single/multi-column and complex layouts (incl. cross-page table merging), and extracts images with captions. Offers CLI, FastAPI, and Gradio WebUI, plus Python/Go/TypeScript SDKs; builds on PDF-Extract-Kit's models.

Python

PDF-Extract-Kit

Library

Model toolbox for extracting content from complex PDFs: layout detection (images/tables/text/titles/formulas), formula detection and LaTeX recognition, OCR with text location, and table recognition to LaTeX/HTML/Markdown. Provides the underlying models that MinerU builds its PDF-to-Markdown application on top of.

Python

pypdfium2

BindingsLibrary

Python ctypes bindings to Google's PDFium: renders pages to images, extracts text, reads metadata/bookmarks/page properties, creates new PDFs and inserts images/pages, and searches for text — with both convenience helper classes and raw PDFium API access.

Python

Unstructured

DriverLibrary

Open-source ETL library that converts complex documents (including PDFs) into clean, structured data for LLM ingestion: PDF text extraction, OCR on scanned pages (via tesseract-ocr/poppler-utils), document layout detection, and partitioning into logical elements via a single `partition()` auto-detection function.

Python

pdf-parser

Cli

Part of the Didier Stevens Suite of security tools: parses a PDF document to identify and inspect its fundamental elements/objects, with an option to search for specific strings within indirect objects — used for PDF malware analysis and forensic triage. Public domain.

Python

malicious-pdf

Cli

Generates 48+ test PDF files for security research: phone-home/callback detection, SSRF, XSS injection, NTLM credential theft via UNC paths, data exfiltration, and XXE injection, with four levels of payload obfuscation and integration with Burp Collaborator/Interact.sh. For authorized penetration testing, bug bounty research, and security product validation only.

Python

ReportLab

Library

Open-source Python library for programmatic PDF generation: precise low-level canvas drawing (text, vector graphics, images) plus a higher-level Platypus layout engine (flowables, paragraphs, tables, automatic pagination) for building complex reports and documents; widely used as the rendering engine underneath other PDF tools (e.g. the included PDFDocument wrapper).

Python

fpdf2

Library

Unicode TrueType font subset embedding, cell/multi-cell/plaintext writing with automatic page breaks, optional Markdown-like text styling, image embedding with transparency, SVG import, arbitrary path drawing, table generation, internal/external links, barcodes/charts/emoji, document encryption and digital signing, annotations (highlights, file attachments), HTML-to-PDF conversion, basic math rendering, and TOC/outline generation.

Python

borb

Library

Pure-Python library for reading, creating, and manipulating PDFs, modeling the file as a JSON-like structure of nested lists/dictionaries/primitives for programmatic access.

Python

Pdfalyzer

Cli

PDF forensics/analysis tool that visualizes a PDF's internal tree-like object structure as large, color-coded diagrams, scans embedded binary streams for suspicious/malicious content using YARA rules (via the companion Yaralyzer), and force-decodes suspicious font binaries.

Python

PAWLS

ServerWeb App

Web-based tool (built by AllenAI) for collecting human annotations on PDFs, purpose-built for academic papers but usable on any PDF collection: preprocesses PDFs into per-page token bounding boxes (optionally via GROBID), serves them in a browser viewer, assigns documents to specific annotators, enforces login/access control, and stores annotations via an API backend.

Stale
Python

Layout Parser

Library

Deep-learning toolkit for document image layout analysis: detects layout elements (text blocks, titles, tables, figures) using pre-trained models, filters/crops regions by spatial location, loads layout data from JSON/CSV/PDF, runs OCR on detected regions, and visualizes detected layouts.

Python

deepdoctection

Library

Apache-2.0 orchestration framework for document AI: combines layout detection and table recognition (via Detectron2/Transformers), OCR (Tesseract, DocTr, or AWS Textract), and document/token classification (LayoutLM family, LiLT, BERT-style models) into configurable pipelines for scanned documents and PDFs.

Python

pydoxtools

Library

Pipeline library for extracting information from unstructured documents with low memory/CPU overhead: PDF table extraction, image analysis with OCR, document question-answering via LLM integration, vector index creation, and support for most common document formats.

Python

OpenContracts

ServerWeb Api

Apache-2.0 self-hosted document-intelligence platform: manages document collections, automatically parses PDF layout and generates vector embeddings, provides a pluggable microservice analyzer architecture for automated annotation, and a human annotation interface (multi-page annotations) built on the PAWLS annotation format. Exposes a GraphQL+REST API, a Model Context Protocol server for agents, and a React UI.

Python

digital-born-pdf-scanner

Cli

CLI tool that checks whether PDF files are 'born-digital' (created directly from a digital source) versus scanned images, scanning single files or whole directories (recursively) and reporting results as TSV/CSV.

Stale