Metadata-Version: 2.4
Name: sealwax
Version: 0.9.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Office/Business
Classifier: Topic :: Security :: Cryptography
Classifier: Typing :: Typed
License-File: LICENSE-MIT
License-File: LICENSE-APACHE
License-File: THIRD_PARTY_NOTICES.md
License-File: licenses/DEPENDENCIES.md
License-File: licenses/LICENSE-CC0
License-File: licenses/LICENSE-FOXIT
License-File: licenses/LICENSE-PDFIUM
License-File: licenses/LICENSE-dingbat-to-unicode
Summary: A PDF library written in Rust: reading, flattening, PDF/A-3 conversion and PAdES signatures.
Keywords: pdf,pdfa,pades,signature,xfdf
Author: Sylvain Boily and the sealwax contributors
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/sealwax/sealwax/blob/main/CHANGELOG.md
Project-URL: Homepage, https://github.com/sealwax/sealwax
Project-URL: Issues, https://github.com/sealwax/sealwax/issues

# sealwax for Python

Python bindings of [sealwax](https://github.com/sealwax/sealwax), a PDF library written in Rust.

- Read PDF documents and their page geometry.
- Fill and flatten annotations, apply XFDF.
- Convert to PDF/A-3 (levels b, u and a).
- Sign with PAdES signatures, timestamps, long-term validation data and document timestamps
  (up to B-LTA). The key stays in your HSM: any object with `sign_digest` signs.
- Check the integrity of the signatures a document holds.
- Convert Word documents (DOCX) to PDF, tagged with their structure and bookmarks, laid out by
  [docxide-pdf](https://github.com/sverrejb/docxide-pdf). Fonts are those installed, and the
  directories you name first.

sealwax works with the interpreter lock released, within `Limits` that bound what a hostile document
may cost, and can run an operation in a process of its own, with a memory cap
(`sealwax.isolated`).

```python
import sealwax

data = open("in.pdf", "rb").read()
archived, report = sealwax.pdfa_convert(data, level="3a", limits=sealwax.Limits(timeout=60))

# The layout's own time is not bounded: a document you do not trust converts in a process of
# its own.
docx = open("in.docx", "rb").read()
pdf, report = sealwax.isolated(sealwax.docx_to_pdf, docx, timeout=60, memory=2 << 30)
```

Licensed under MIT OR Apache-2.0, at your option.


`Document.words`, `Document.text_blocks` and `Document.search` read the current page,
including pending edits. They omit character boxes outside the page crop or the bounding
boxes of active clipping paths, including form and annotation appearance boxes.
Invisible OCR text inside these bounds remains searchable.

`sign`, `verify_signatures`, `add_document_timestamp` and `add_validation_data` accept
a keyword-only `limits` argument. Explicit limits are checked before contacting a key
provider or network service. The deadline counts local PDF processing, including hashing.
Configure network and HSM timeouts on those clients.

`doc.insert_image(0, (36, 36, 180, 108), image_bytes)` draws a JPEG or PNG over the
first page. The rectangle gives the left, bottom, right and top edges in default PDF
user space, before page rotation. The image is centered and keeps its proportions.
Pass `keep_proportion=False` to fill the rectangle. JPEG orientation and PNG transparency
are honored, and the document's `max_image_pixels` applies.

