# pypdfium2

> Python bindings to PDFium, reasonably cross-platform

Source: https://talira.ai/catalog/pypdfium2-2qb89jmf
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Command-line tool
- Categories: [documents / pdf / rendering](https://talira.ai/categories/documents/pdf/rendering), [documents / pdf / extraction](https://talira.ai/categories/documents/pdf/extraction), [languages / python](https://talira.ai/categories/languages/python)
- Platforms: linux, macos, windows, android[^6]
- Licence: Apache-2.0 OR BSD-3-Clause[^1][^3][^4][^5]
- Pricing: Free and open source[^1]
- Pricing notes: Apache-2.0 or BSD-3-Clause, free. Wheels bundle PDFium (BSD-style licence) and its dependencies' licences.
- Free tier: yes[^1]
- Self-hostable: yes[^1]

pypdfium2 is a Python binding to PDFium, a liberally licensed C library for PDF rendering, inspection, manipulation and creation, with pre-built wheels that bundle PDFium for Windows, [macOS](https://talira.ai/catalog/macos-8swyggxb.md), Linux (glibc and musl) and Android. Its helper classes render pages to bitmaps (with PIL and NumPy adapters), extract and search text, read the table of contents, extract images and attachments, rearrange and merge pages and create PDFs, while the raw PDFium C API stays available through ctypes; a `pypdfium2` command line covers rendering, text and image extraction and more. It's licensed Apache-2.0 or BSD-3-Clause, so unlike [PyMuPDF](https://talira.ai/catalog/pymupdf-xw9pb5xf.md) (AGPL) it renders PDFs in Python without strong copyleft; [PDF.js](https://talira.ai/catalog/pdf-js-ce376y3j.md) and the Rust [pdfium-render](https://talira.ai/catalog/pdfium-render-yyd0t2g5.md) fill the same role in other languages.

## Links

- GitHub: https://github.com/pypdfium2-team/pypdfium2
- Docs: https://pypdfium2.readthedocs.io/en/stable/

## Problems it solves

- render PDF pages to PNG in Python without pulling in an AGPL library
- take screenshots of every page of a generated PDF so a visual regression test can diff them
- turn PDF pages into images I can feed to a vision model or OCR
- rasterize PDFs on a server with Chrome's PDF engine instead of poppler
- extract the text of a PDF together with the region it sits in
- show how a filled PDF form looks with its field values drawn on the page
- convert PDF pages to NumPy arrays for an image processing pipeline
- merge pages from several PDFs and save the result from Python
- pull the embedded images and file attachments out of a PDF
- a pip-installable PDF renderer with wheels for Linux ARM, musl and Windows, no system packages needed
- turn a folder of JPEG scans into one PDF from the command line

## Features

- render pages at any scale or rotation, with optional form fields, to PIL images or NumPy arrays
- text extraction by region or character range, and text search
- table of contents, page labels and page boxes
- page objects: iterate, insert and remove; image extraction
- embedded file attachments: list, extract, add and delete
- create PDFs, add pages, import pages from other documents and save
- flatten forms and annotations
- raw PDFium API through ctypes (pypdfium2.raw)
- CLI subcommands: render, extract-text, extract-images, arrange, tile, toc, attachments, imgtopdf, pdfinfo, fonts
- pre-built wheels for Windows, macOS, Linux glibc and musl, and Android; experimental Pyodide
- optional V8 (JavaScript) and XFA-enabled PDFium builds through a source install (PDFIUM_PLATFORM=auto-v8)
- can bind against a system or self-built PDFium

## Limitations

- Isn't thread-safe: PDFium can't be called from several threads at once, even for different documents, so render in parallel with processes[^1][^2]
- Doesn't give access to raw PDF objects (dictionaries, streams, name trees): PDFium's public API offers only higher-level functions[^1]

## Capabilities

- Has a command line tool: plan not known

## Trust

Overall: 0.20 out of 1.
Signals: backing 0.00, extensibility 0.20.

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [PyMuPDF](https://talira.ai/catalog/pymupdf-xw9pb5xf.md): A high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
- [PDF.js](https://talira.ai/catalog/pdf-js-ce376y3j.md): PDF Reader in JavaScript
- [pdfium-render](https://talira.ai/catalog/pdfium-render-yyd0t2g5.md): A high-level idiomatic Rust wrapper around Pdfium, the C++ PDF library used by the Google Chromium project.
- [pdfplumber](https://talira.ai/catalog/pdfplumber-phcpd0sv.md): Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables.

## Sources

[^1]: https://github.com/pypdfium2-team/pypdfium2 (checked 20 Nov 2026)
[^2]: https://pypdfium2.readthedocs.io/en/stable/python_api.html (checked 20 Nov 2026)
[^3]: https://github.com/pypdfium2-team/pypdfium2/blob/main/LICENSES/Apache-2.0.txt (checked 20 Nov 2026)
[^4]: https://github.com/pypdfium2-team/pypdfium2/blob/main/LICENSES/BSD-3-Clause.txt (checked 20 Nov 2026)
[^5]: https://pypi.org/project/pypdfium2/ (checked 20 Nov 2026)
[^6]: https://pypdfium2-team.github.io/pypdfium2/platforms.html (checked 20 Nov 2026)
