render_invoice_pdf
Create an official PDF copy of an archived KSeF invoice locally, reproducing the exact format the Ministry's verification portal shows.
Instructions
Write one archived invoice as the PDF the Ministry's own application shows.
ksef_number names an invoice already in the archive. Nothing is fetched:
this call spends none of the twenty metadata queries an hour and works with
no network at all. An invoice that has not been synchronised yet is refused
rather than downloaded, so the answer never depends on a query budget.
The document is produced by the Ministry's own generator, run locally from a
build vendored with this package — the same code the verification portal
loads into a browser. Fidelity is therefore official rather than
approximate, and generator_version names the build, the same string the
footer of the document carries.
working_directory overrides the directory declared during onboarding for
this one call, under the same rules as the statement: created 0700 if new,
refused inside the cache or data root, and reported in warnings when its
path looks like a cloud sync folder or its permissions are wider than 0700.
A synced directory the taxpayer acknowledged during onboarding is not
reported again. The PDF names the counterparty exactly as the statement
does.
On production the document carries the QR code and verification link, and
verification_url repeats it here. Test and demo invoices have no
verification surface, so both are absent rather than pointing at a page that
would not resolve.
Requires Node — uvx cannot install it and a Python package cannot depend
on it. Without Node this one call fails with a message saying what to
install; synchronisation, the CSV statement and the listing are unaffected.
The generator accepts FA(1), FA(2), FA(3), UPO and PEF, but only FA(3) has been exercised end to end. Treat a refusal on an older schema as untested rather than impossible, and report it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ksef_number | Yes | ||
| working_directory | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nip | Yes | ||
| path | Yes | ||
| message | Yes | ||
| warnings | No | ||
| byte_count | Yes | ||
| environment | Yes | ||
| ksef_number | Yes | ||
| verification_url | Yes | ||
| generator_version | Yes |