Skip to main content

Overview

Penquify uses Jinja2 HTML templates to render documents. The default template is guia_despacho.html (Chilean dispatch guide). You can add your own templates for invoices, purchase orders, bills of lading, or any other document type.

Template Location

Templates live in penquify/templates/. Add your .html file there.

Available Variables

Templates receive the full document data via doc.to_dict(): Each item in items has: pos, code, description, qty, unit, unit_price, total, batch, sap_material, sap_qty, sap_unit.

Template Structure

1

Create the HTML file

Create penquify/templates/my_invoice.html:
2

Use it in generation

Or via CLI:
Or via API:
Wrap your document content in a div.page element. The PNG renderer looks for .page to screenshot. If not found, it captures the full viewport.

Design Tips

  • Use a fixed width (e.g. 850px) for consistent rendering across documents
  • Use standard fonts that Playwright’s Chromium can render
  • Keep the design realistic — penquify generates photos of these documents, so they should look like real printed pages
  • Test your template by generating the PDF first before creating photo variations