Python HTML reporting engine
Project description
ZipReport
Transform HTML templates into beautiful PDF or MIME reports, with full CSS and client Javascript support, under a permissive license.
Highlights:
- Create your reports using Jinja templates;
- Dynamic image support (embedding of runtime-generated images);
- Reports are packed in a single file for easy distribution or bundling;
- Optional MIME processor to embed resources in a single email message;
- Support for generated JS content (with zipreport-server or zipreport-cli);
- Support for headers, page numbers and ToC (via third party javascript);
Requirements:
- Python >= 3.6
- Jinja2 >= 2.11
- Compatible backend for pdf generation (zipreport-server, zipreport-cli or WeasyPrint);
Installation
$ pip install zipreport-lib
Quick example
Using zipreport-cli backend to render a report file:
from zipreport import ZipReportCli
from zipreport.report import ReportFileLoader
# path to zipreport-cli binary
cli_path = "/opt/zpt-cli/zpt-cli"
# output file
output_file = "result.pdf"
# template variables to be used for rendering
report_data = {
'title': "Example report using Jinja templating",
'color_list': ['red', 'blue', 'green'],
'description': 'a long text field with some filler description so the page isn\'t that empty',
}
# load zpt report file
zpt = ReportFileLoader.load("reports/simple.zpt")
# render the report with default job options
result = ZipReportCli(cli_path).render_defaults(zpt, report_data)
if result.success:
# write output file
with open(output_file, 'wb') as rpt:
rpt.write(result.report.read())
Documentation
Still a work in progress
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zipreport-lib-0.9.1.tar.gz
(39.9 kB
view hashes)
Built Distribution
Close
Hashes for zipreport_lib-0.9.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 891d2beb7c6b50403739c1a262e186896a824388f7a48eea9112e1a044673f89 |
|
MD5 | 1e3ce62bd4cf967bd61b81c9ce8f0701 |
|
BLAKE2b-256 | 1c07cde8bd929a5a202c09b4629be7c1fd2fc05cee9da3411104b456fc4f25da |