Skip to content
@pypdfium2-team

pypdfium2-team

pypdfium2-team

This is the place of development for a liberal-licensed1 Python PDF rendering library, powered by PDFium.

Supported Environment 2

  • CPython >= 3.6 3
  • Windows amd64 / arm64 / win32
  • macOS x86_64 (10.13+) / arm64 (11.0+)
  • Linux (glibc) x86_64 / i686 / aarch64 / armv7l
  • Linux (musl) x86_64 / i686 / aarch64

These are the platforms that we support with wheels / pre-built binaries. In principle, pypdfium2 may run anywhere provided you are able to procure a pdfium build for the platform. 4

Installation

python3 -m pip install pypdfium2

Example

import pypdfium2 as pdfium

# Load a document
pdf = pdfium.PdfDocument("tests/resources/multipage.pdf")

# Loop over pages and render
for i in range(len(pdf)):
    page = pdf[i]
    image = page.render(scale=4).to_pil()
    image.save(f"output_{i:03d}.jpg")

Advantages

  • Liberal license (BSD-3-Clause, Apache-2.0, plus various other open-source licenses for third-party components of PDFium.)
  • Wide range of supported platforms and Python versions.
  • No mandatory runtime dependencies.
  • Can process encrypted (password-protected) PDFs.
  • Rendering is fast, outperforming ghostscript and poppler. In terms of speed, pypdfium2 can almost reach pymupdf.
  • Multiple choices for the rendering return type:

References

For pdfium documentation, please look at the comments in its public header files (public/*.h).

Footnotes

  1. Disclaimer: This is not legal advice. While we hope this project is useful to others, there is ABSOLUTELY NO WARRANTY. It is the embedder's responsibility to check on licensing. See also GitHub's disclaimer.

  2. As of Jan 2025

  3. PyPy might work but is not tested.

  4. This is down to the embedder or distributor.

Pinned Loading

  1. pypdfium2 pypdfium2 Public

    Python bindings to PDFium

    Python 471 19

  2. ctypesgen ctypesgen Public

    Forked from ctypesgen/ctypesgen

    Wrapper generator for Python ctypes

    Python 1 1

Repositories

Showing 3 of 3 repositories
  • .github Public

    Organisation profile

    pypdfium2-team/.github’s past year of commit activity
    1 0 1 0 Updated Jan 16, 2025
  • pypdfium2 Public

    Python bindings to PDFium

    pypdfium2-team/pypdfium2’s past year of commit activity
    Python 471 19 4 1 Updated Jan 16, 2025
  • ctypesgen Public Forked from ctypesgen/ctypesgen

    Wrapper generator for Python ctypes

    pypdfium2-team/ctypesgen’s past year of commit activity
    Python 1 BSD-2-Clause 90 3 1 Updated Dec 27, 2024

Top languages

Python

Most used topics

Loading…