Metadata-Version: 2.4
Name: rofd-convert
Version: 0.1.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Office Suites
License-File: LICENSE
License-File: NOTICE
Summary: Headless OFD to PDF conversion (PyO3 bindings over the rofd kernel)
Keywords: ofd,pdf,converter,office,gbt-33190
License-Expression: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/office-rs/rofd

# rofd-convert-py

Headless OFD (GB/T 33190) to PDF conversion — PyO3 bindings over the
`rofd-convert` kernel (convert spec §6.6).

## Install (wheel, abi3-py39+)

```bash
pip install rofd-convert
```

Dev build from the repository root:

```bash
py -3.1 -m maturin build --release -m crates/convert-py/Cargo.toml -o target/wheels
py -3.1 -m pip install --force-reinstall target/wheels/rofd_convert-*.whl
```

## Usage

```python
from rofd_convert import Converter, register_font_file

# Once per process, BEFORE the first Converter (registry snapshot).
# Real documents declaring non-embedded fonts need a registered font.
register_font_file("simsun.ttc")

c = Converter()
pdf, warnings = c.convert(ofd_bytes)
# Content flags are all on by default; flip per call:
pdf2, _ = c.convert(ofd_bytes, watermark=False, max_pages=50)
```

`convert` releases the GIL during the kernel call; one instance serves
one call at a time (a concurrent call raises `ConvertError("converter
in use")`). For throughput, give each thread its own instance
(`threading.local`) — `demo/run.py` shows the ThreadPoolExecutor recipe.

## Acceptance

```bash
py -3.1 crates/convert-py/demo/run.py   # pooled converts == CLI bytes
```

