neuron-explorer
Qwen3.5‑4B 전용 조향형 뉴런 탐색기, 모든 MLP 뉴런을 밀어 결과를 보관·탐색
PDF editing, rendering, extraction, and generation for Python on the Rust engines lopdf, hayro, and krilla — MIT, safe on untrusted input, WebAssembly-ready.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Edit, render, extract, and create PDFs in Python.
pylopdf aims to give Python programs complete control of PDF: every feature of the PDF 2.0 specification read, interpreted, created, edited, and preserved, including everything that pymupdf does with PDF files, through a smaller API of its own. The roadmap defines the scope, exclusions, and evidence required for a completeness claim; API stability at v1.0 alone will not establish complete coverage. It is built on the Rust PDF engines lopdf, hayro, and krilla, released under the MIT license, and installs as a single wheel with no required Python dependencies.
Documentation · Getting started · API reference · Migrating from pymupdf
Status: pylopdf is pre-1.0. Version 0.16 redesigned its API, as the roadmap describes; the migration guide covers code written for pymupdf or pylopdf 0.15. Complete control is the goal, not yet the state: the roadmap's assessment lists the gaps. The stability policy explains what may change.
pip install pylopdf
Python 3.11 or newer. Wheels are available for Linux, macOS, and Windows, including free-threaded Python 3.14t and 3.15t.
Optional extras add fonts and OCR models:
| Extra | Adds |
|---|---|
jp, ko, zh-cn, zh-tw | Japanese, Korean, and Chinese fonts for displaying and writing text |
ar, he, hi, th | Arabic, Hebrew, Hindi, and Thai fonts for writing text |
ocr | An offline OCR engine for scanned pages |
pip install "pylopdf[jp,ocr]"
import pylopdf
doc = pylopdf.open("input.pdf")
page = doc.pages[0]
# Extract
text = page.text() # plain text
words = page.words() # words with their positions
hits = page.search("invoice") # rectangles of each match
tables = page.tables() # tables with their cell text
markdown = doc.markdown() # whole document as Markdown
# Render
page.pixmap(dpi=150).save("page.png")
svg = page.svg()
# Add content
with page.draw() as canvas:
canvas.text("Approved", (72, 72), size=20, fill=pylopdf.Color(0.8, 0, 0))
canvas.image((72, 100, 200, 200), "logo.png")
page.annotations.add(pylopdf.Highlight(hits))
# Reorganize pages (fetch pages again with doc.pages[i] afterwards)
del doc.pages[1:3]
doc.pages.extend(pylopdf.open("appendix.pdf").pages) # append another document
# Save, compressed and without unused objects
doc.save("output.pdf")
The getting started guide covers each area in more detail.
LimitError instead of exhausting memory; DocumentLimits.web() enables
all of them. See the security model.Redaction, editing or deleting annotations, creating form fields, and validated PDF/A and PDF/UA output are planned; the roadmap lists them.
Typesetting with HTML and CSS and digital signatures stay with ecosystem tools. The ecosystem guide shows how to pair pylopdf with typst and pyHanko for those.
Benchmarks against pymupdf are reproducible from this repository, and the results include the cases where pylopdf is slower. See the benchmark page.
Bug reports and pull requests are welcome. Building from source needs a Rust toolchain and uv:
uv sync
uv run pytest
CONTRIBUTING.md has the full development guide. Please report security issues privately through GitHub Security Advisories.
MIT. pylopdf is built on lopdf, hayro, krilla, and HarfRust; see NOTICE.md for third-party licenses.