pcloadletter
A CLI tool to generate PDF documents from HTML templates
"PC LOAD LETTER" - WFT does that mean?!
Installation
pip install pcloadletter
Usage
pcloadletter lets you generate a pdf document from an HTML Jinja template given some context data from the command line and/or a .yml/.json file.
usage: pcloadletter [-h] [-t TEMPLATE] [-o OUT] [-c CONTEXT_FILE] [extra_context ...]
Generate PDF file from a Jinja-rendered HTML template
positional arguments:
extra_context key=value pairs which are added to the template context (default: None)
optional arguments:
-h, --help show this help message and exit
-t TEMPLATE, --template TEMPLATE
The invoice template to render. (default: invoice.html)
-o OUT, --out OUT Destination file. (default: invoice.pdf)
-c CONTEXT_FILE, --context-file CONTEXT_FILE
A .yml or .json file containing context for the template. (default: None)
Examples:
pcloadletter --template templates/invoice.html --out invoice.pdf invoice_number=2021-001 invoice_date=`date +%Y-%m-%d`
pcloadletter --template report.html --context-file=report-data.yml addressee="Mr. M. Bolton"
For example, given a template file hello.html:
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Hello {{ target }}!</h1>
</body>
</html>
and a stylesheet:
.h1 {
font-style: italic;
}
we can render the pdf like so;
pcloadletter --template hello.html target="world out there"
The context could have been given in a context file hello.yml;
target: world out there
pcloadletter --template hello.html --context-file=hello.yml
The above commands will generate a file invoice.pdf in the current directory. You can
change the destination using
--out=~/Documents/report.pdf
Metadata
Release files for pcloadletter 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pcloadletter-0.3.2.tar.gz | 10.6 kB | Without provenance | Details for pcloadletter-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pcloadletter-0.3.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for pcloadletter-0.3.2-py2.py3-none-any.whl |
Total release size: 16.3 kB
Release files / pcloadletter-0.3.2.tar.gz
| Download URL | pcloadletter-0.3.2.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67f7beba803cb8562260310733cda0c9a77f5c09a6bf1eeb1e80ed40b5c63de1
|
|
BLAKE2b-256 checksum How to use checksums |
c1c957dbd6a0667e2beb5d7e569af262e25d2387bb85327fafa570596fbee90b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / pcloadletter-0.3.2-py2.py3-none-any.whl
| Download URL | pcloadletter-0.3.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
cb80d231d1b8a41a576211c9041204f8f24aad458efc1326578bfe956c643327
|
|
BLAKE2b-256 checksum How to use checksums |
fb74f3a50a01ee8369bdfc64bff339df75bd9f32bfeed996913f423791d5d61d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for pcloadletter 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.