Very lightweight PDF report generation
Project description
zipreport
Very lightweight module for creating PDF reports with Python
Motivation
This library is meant to be a drop-in replacement for report generation I was doing with Filemaker Pro and
operates under about the same principles as print layout on Filemaker Pro. You, the client, have a list of
ordered records, which can be any subscriptable thing but in my example are dicts, and these are fed into
a Document object you create and customize which establishes how fields in each record are formatted and
laid out on the page, the formatting of page headers and footers, and summary headers and footers.
Example
In the example you can see how a basic report is customized. All formatting is
contained in a Document object, draws Part objects in various parts of the document based on certain
conditions. The page_header and page_footer parts are drawn at the top and bottom of each page.
Each record to be printed is displayed in a content_part:
content_part = Part(
elements=[Element(x=0.,
y=0.,
width=72.,
height=18.,
content=FormattedText("N:$name", font_family='Futura', font_size=9.)),
Element(x=96.,
y=0,
width=72.*4.,
height=4.*72.,
can_shrink=True,
content=FormattedText("$comment", font_family='Futura', font_size=9.)),
Element(x=72. * 6, y=0., width=36, height=18,
content=FormattedText("$rn", font_family='Futura', font_size=9.,
alignment='r'))],
minimum_height=72.
)
A Part contains a list of Element objects which define a rectangle (positioned relative to the origin,
the upper-left corner of the parent Part), and each element has a corresponding Content. Content
objects contain specific style and content. The FormattedText content has a format string which can
substitute values from a content object. For example above, the first element reades the 'name' key from
the content object and substitutes it into the format string.
Under Contruction
This project is still under contruction but functions on a basic level.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zipreport-0.1.tar.gz.
File metadata
- Download URL: zipreport-0.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1be1f9446613e0a1c9747328ed65eee62e2f94b182c2110e5823938913e8fb8
|
|
| MD5 |
08881a7a9dd59c734df4d7ad4827a2b7
|
|
| BLAKE2b-256 |
8d7fccd3b2e2e7a799678265aa3839a5a31e70ea9b54741fa4411ddd8e0a5514
|
File details
Details for the file zipreport-0.1-py3-none-any.whl.
File metadata
- Download URL: zipreport-0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
004c2eedb091a68591ff22e84a790dd0e035007350c5058c70a215c8109fc65f
|
|
| MD5 |
dec918f78d15ea81bdcf1df230a27fc9
|
|
| BLAKE2b-256 |
e90a4f20f9477d2127d743f41e229841848402588f589aef0cbba5900abbc732
|