Skip to content
@pypdfium2-team

pypdfium2-team

pypdfium2-team

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

Supported Environment

  • CPython >= 3.6 1
  • 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

(as of Mar 2023)

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. PyPy might work but is not tested.

Pinned Loading

  1. pypdfium2 pypdfium2 Public

    Python bindings to PDFium

    Python 428 17

  2. ctypesgen ctypesgen Public

    Forked from ctypesgen/ctypesgen

    Wrapper generator for Python ctypes

    Python 1 1

Repositories

Showing 3 of 3 repositories

Top languages

Loading…

Most used topics

Loading…