Metadata-Version: 2.4
Name: rendoc
Version: 1.0.0
Summary: Official rendoc SDK for Python - PDF generation API
Project-URL: Homepage, https://rendoc.dev
Project-URL: Documentation, https://rendoc.dev/docs
Project-URL: Repository, https://github.com/rendoc/rendoc-python
Project-URL: Changelog, https://github.com/rendoc/rendoc-python/blob/main/CHANGELOG.md
License-Expression: MIT
Keywords: api,document,generation,pdf,rendoc
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24.0
Description-Content-Type: text/markdown

# rendoc

Official Python SDK for the [rendoc](https://rendoc.dev) PDF generation API.

- Sync and async clients
- Full type hints
- Python 3.9+

## Installation

```bash
pip install rendoc
```

## Quick start

### Sync

```python
from rendoc import Rendoc

client = Rendoc(api_key="rnd_...")

# Generate a PDF from markup
doc = client.documents.generate(
    markup="<h1>{{title}}</h1>",
    data={"title": "Hello World"},
    paper_size="A4",
)
print(doc.download_url)

# Generate from a template
doc = client.documents.generate(template_id="tmpl_123", data={"name": "John"})

# List templates
templates = client.templates.list()
invoices = client.templates.list(category="INVOICE")

# Check usage
usage = client.usage.get()
print(f"{usage.usage.documents}/{usage.usage.limit} documents used")
```

### Async

```python
import asyncio
from rendoc import AsyncRendoc

async def main():
    client = AsyncRendoc(api_key="rnd_...")
    doc = await client.documents.generate(
        markup="<h1>Hi</h1>",
        data={},
    )
    print(doc.download_url)
    await client.close()

asyncio.run(main())
```

### Context manager

```python
# Sync
with Rendoc(api_key="rnd_...") as client:
    doc = client.documents.generate(markup="<h1>Hi</h1>", data={})

# Async
async with AsyncRendoc(api_key="rnd_...") as client:
    doc = await client.documents.generate(markup="<h1>Hi</h1>", data={})
```

## Error handling

```python
from rendoc import Rendoc, AuthenticationError, RateLimitError, RendocError

client = Rendoc(api_key="rnd_...")

try:
    doc = client.documents.generate(markup="<h1>Hi</h1>", data={})
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests — slow down")
except RendocError as e:
    print(f"API error: {e.message} (status {e.status_code})")
```

## Custom base URL

```python
client = Rendoc(api_key="rnd_...", base_url="https://custom.rendoc.dev")
```

## Documentation

Full API reference at [https://rendoc.dev/docs](https://rendoc.dev/docs).
