Metadata-Version: 2.4
Name: reportdesigner
Version: 0.4.7
Summary: ReportDesigner engine for Python (Django, Flask, FastAPI, scripts): JSON report + data -> HTML/PDF. Native Rust core.
Author: Ariful Alam
License: Apache-2.0
Project-URL: Homepage, https://github.com/arifulalam/ReportDesigner
Project-URL: Documentation, https://github.com/arifulalam/ReportDesigner/tree/main/docs
Project-URL: Issues, https://github.com/arifulalam/ReportDesigner/issues
Keywords: report,reporting,pdf,xlsx,docx,crystal-reports,invoice
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Printing
Classifier: Topic :: Office/Business
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# reportdesigner (Python)

Render **ReportDesigner** reports to PDF, HTML, Excel and Word from Python: Django, Flask, FastAPI, Celery jobs or plain scripts. One wheel with the native Rust engine inside; no dependencies.

```
pip install reportdesigner
```
Python 3.8 or newer. Wheels carry the engine for Windows, Linux (x64, arm64) and macOS.

## Quick start

```python
import json
from reportdesigner import ReportEngine

engine = ReportEngine()                      # one per process; thread-safe
report = json.load(open("invoice.report.json", encoding="utf-8"))

pdf  = engine.render_pdf(report, parameters={"Region": "EU"}, data={"invoices": rows})   # bytes
html = engine.render_html(report, parameters={"Region": "EU"}, data={"invoices": rows}) # str
xlsx = engine.render_xlsx(report, data={"invoices": rows})                               # bytes
docx = engine.render_docx(report, data={"invoices": rows})                               # bytes
open("invoice.pdf", "wb").write(pdf)
```
Options on every `render_*`: `parameters`, `data`, `subreports`, `now`. `engine.render(request_dict, "pdf")` takes a complete request document. Errors raise `ReportError`. `Decimal`, `datetime`, `UUID` and `bytes` values are converted for you.

## Data

Pass rows you already have in `data` (Django ORM `.values()`, SQLAlchemy rows as dicts, `DataFrame.to_dict("records")`). For live SQL there is a ready-made provider for any DB-API driver (`pyodbc`, `sqlite3`, `psycopg`, ...); the report's `@Name` query parameters are bound for you:

```python
import pyodbc, sqlite3
from reportdesigner import ReportEngine, SqlProvider

sql = SqlProvider({
    "main":  lambda: pyodbc.connect(CONN_STR),                       # factory, opened and closed per query
    "local": sqlite3.connect("cache.db", check_same_thread=False),   # or an existing connection
})
engine = ReportEngine(data_source=sql)
```
A custom callback is `ReportEngine(data_source=lambda ds, params: rows)`.

## Fonts

Built-in fonts cover Latin text. For other scripts (Bengali, Arabic, Hindi, CJK ...) add a font once at startup; text in the report then uses it, with automatic fallback between fonts:

```python
engine.add_font(open("NotoSansBengali-Regular.ttf", "rb").read())
```

## What you get

- **Real report features:** bands and groups, running totals and summaries, parameters, expressions, subreports, cross-tabs, charts, barcodes and QR codes, sparklines, images, conditional formatting, page headers and footers.
- **Four outputs from one definition:** HTML, PDF, Excel (.xlsx) and Word (.docx).
- **Real-world text:** embedded subset fonts, Bengali / Arabic / Indic shaping, right-to-left and mixed-direction lines, font fallback.
- **Nothing else to install:** no browser, no LibreOffice, no system fonts, no network access. The engine does not read files; you pass data in.
- **Identical output everywhere:** HTML and PDF are byte-for-byte the same in every language (verified against golden files in CI).
- **Visual designer:** reports are JSON files created in the ReportDesigner designer (runs in any browser), or written by hand.

## Framework guides

Django, Flask and FastAPI examples: <https://github.com/arifulalam/ReportDesigner/blob/main/docs/python.md>.


## Other languages

The same engine is available for [.NET](https://www.nuget.org/packages/ReportDesigner), [Node.js](https://www.npmjs.com/package/@syncmachine/reportdesigner), [Python](https://pypi.org/project/reportdesigner/), [Rust](https://crates.io/crates/reportdesigner), Java and PHP, and for any other language through a small C interface. Guides for each language and its frameworks: <https://github.com/arifulalam/ReportDesigner/blob/main/docs>.

## Links

- Documentation: <https://github.com/arifulalam/ReportDesigner/blob/main/docs>
- Source and issues: <https://github.com/arifulalam/ReportDesigner>
- Changelog: <https://github.com/arifulalam/ReportDesigner/blob/main/CHANGELOG.md>

## Licence

Apache-2.0. See `LICENSE`.
