Metadata-Version: 2.4
Name: pylopdf
Version: 0.16.1
Classifier: Development Status :: 7 - Inactive
Classifier: Environment :: WebAssembly :: Emscripten
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: pylopdf-fonts-ar>=0.1.1,<0.2 ; extra == 'ar'
Requires-Dist: pylopdf-fonts-he>=0.1.1,<0.2 ; extra == 'he'
Requires-Dist: pylopdf-fonts-hi>=0.1.1,<0.2 ; extra == 'hi'
Requires-Dist: pylopdf-fonts-jp>=0.1.1,<0.2 ; extra == 'jp'
Requires-Dist: pylopdf-fonts-ko>=0.1.1,<0.2 ; extra == 'ko'
Requires-Dist: libcst>=1.8 ; extra == 'migrate'
Requires-Dist: pylopdf-ocr-models>=0.1.0,<0.2 ; extra == 'ocr'
Requires-Dist: pylopdf-fonts-th>=0.1.1,<0.2 ; extra == 'th'
Requires-Dist: pylopdf-fonts-zh-cn>=0.1.1,<0.2 ; extra == 'zh-cn'
Requires-Dist: pylopdf-fonts-zh-tw>=0.1.1,<0.2 ; extra == 'zh-tw'
Provides-Extra: ar
Provides-Extra: he
Provides-Extra: hi
Provides-Extra: jp
Provides-Extra: ko
Provides-Extra: migrate
Provides-Extra: ocr
Provides-Extra: th
Provides-Extra: zh-cn
Provides-Extra: zh-tw
License-File: LICENSE
License-File: NOTICE.md
License-File: LICENSES/AGL-BSD-3-Clause.txt
License-File: LICENSES/APAFML.txt
License-File: LICENSES/Apache-2.0.txt
License-File: LICENSES/PDFium-BSD-3-Clause.txt
Summary: Archived; succeeded by pyropdf. PDF editing, rendering, extraction, and generation for Python, powered by Rust.
Home-Page: https://github.com/yhay81/pylopdf
Author-email: Yusuke Hayashi <yusuke8h@gmail.com>
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/yhay81/pylopdf/blob/main/CHANGELOG.md
Project-URL: Documentation, https://pylopdf.haya.works/
Project-URL: Homepage, https://github.com/yhay81/pylopdf
Project-URL: Issues, https://github.com/yhay81/pylopdf/issues
Project-URL: Source, https://github.com/yhay81/pylopdf

# pylopdf

[![PyPI](https://img.shields.io/pypi/v/pylopdf)](https://pypi.org/project/pylopdf/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/yhay81/pylopdf/blob/main/LICENSE)

> **Archived — migrate to [pyropdf](https://github.com/yhay81/pyropdf).**
>
> `pylopdf` is archived; `0.16.1` is its final release, and this repository no
> longer accepts issues, pull requests, or security fixes. Development
> continues in **[pyropdf](https://github.com/yhay81/pyropdf)**
> ([documentation](https://pyropdf.haya.works/) ·
> [PyPI](https://pypi.org/project/pyropdf/) ·
> [design](https://github.com/yhay81/pyropdf/blob/main/DESIGN.md)).

## Migrate to pyropdf

```bash
pip uninstall pylopdf
pip install pyropdf
```

`pyropdf` keeps `pylopdf`'s concept and API design, rebuilt on a single
versioned object store in Rust
([why the foundation changed](https://github.com/yhay81/pyropdf/blob/main/DESIGN.md#2-evidence-from-pylopdf)):

- Every engine reads the current document version from one store instead of
  reserializing a `lopdf` graph after each edit, so edits cost what they touch.
- Every edit produces an immutable version: failed transactions roll back
  without cloning the document, and `doc.history` undoes and redoes changes.
- Untouched objects keep their original bytes on save, and `doc.changes`
  reports signatures or PDF/A and PDF/UA claims that a save would invalidate.

```python
import pyropdf

with pyropdf.open("input.pdf") as doc:
    page = doc.pages[0]
    text = page.text()
    hits = page.search("invoice")
    page.pixmap(dpi=150).save("page.png")

    with doc.transaction("annotate"):
        page.annotations.add(pyropdf.Highlight(hits))
    doc.save("output.pdf", incremental=True)
```

### Updating existing code

1. **From `pylopdf` 0.16:** replace `import pylopdf` with `import pyropdf` and
   check the differences below.
2. **From `pylopdf` 0.15 or `pymupdf`:** if you want mechanical rewrites to the
   0.16 API first, run `python -m pylopdf.migrate src/` from
   `pylopdf[migrate]==0.16.1`, then replace `import pylopdf` with
   `import pyropdf`.

Key differences between `pylopdf` 0.16 and `pyropdf`:

- **Extras:** `pyropdf[ocr]`, `pyropdf[jp]`, `pyropdf[ko]`, `pyropdf[zh-cn]`,
  and `pyropdf[zh-tw]` reuse the existing `pylopdf-ocr-models` and
  `pylopdf-fonts-*` data packages. For other scripts (`ar`, `he`, `hi`, `th`),
  pass a font file to `pyropdf.Font.from_file(...)`.
- **Page boxes:** read and assign `page.media_box`, `page.crop_box`,
  `page.bleed_box`, `page.trim_box`, and `page.art_box` (in display space)
  instead of `page.boxes.*`.
- **Creating documents:** create an empty document with `pyropdf.Document()`,
  add pages with `doc.pages.new(...)` or `doc.pages.new_from_image(...)`, and
  draw with `page.draw()`, in place of `pylopdf.create()`.
- **Saving defaults:** `doc.save()` preserves untouched objects by default
  (`compress=False, prune=False`); pass `compress=True, prune=True` when
  rewriting for size, or `incremental=True` to append only changed objects.
- **Warnings:** `PyropdfWarning` replaces `PylopdfWarning`.
- **Untrusted input and WebAssembly:** see
  [pyropdf's status and safety notes](https://pyropdf.haya.works/status/) and
  [limits guide](https://pyropdf.haya.works/limits/#reading-a-pdf-in-a-worker)
  before processing untrusted PDFs; WebAssembly wheels for `pyropdf` are
  tracked on [its roadmap](https://github.com/yhay81/pyropdf/issues/1).
  Existing `pylopdf` releases remain installable from
  [PyPI](https://pypi.org/project/pylopdf/) and
  [GitHub Releases](https://github.com/yhay81/pylopdf/releases).

## About pylopdf (archived)

`pylopdf` was a Python PDF library built on the Rust PDF engines
[lopdf](https://github.com/J-F-Liu/lopdf),
[hayro](https://github.com/LaurenzV/hayro),
[krilla](https://github.com/LaurenzV/krilla), and
[HarfRust](https://github.com/harfbuzz/harfrust). Its
[changelog](https://github.com/yhay81/pylopdf/blob/main/CHANGELOG.md) and
[roadmap](https://github.com/yhay81/pylopdf/blob/main/ROADMAP.md) remain in
this repository as a record.

## License

[MIT](https://github.com/yhay81/pylopdf/blob/main/LICENSE). See
[NOTICE.md](https://github.com/yhay81/pylopdf/blob/main/NOTICE.md) for
third-party licenses.

