Skip to content

Print

<!-- generated:meta -->

Grupui
Planeresource
Spec structPrintSpec

<!-- /generated:meta -->

Kapan Memakai

kind: Print adalah dokumen cetak untuk satu entity, multi-target output.

Kapan memakai Print:

  • Invoice, struk POS, surat jalan, label
  • Output pdf / thermal / dotmatrix / html

Kapan TIDAK pakai Print:

  • Laporan tabular terparameterisasi → kind: Report

Sumber kontrak: docs/spec/frontend/06-page-kinds.md §8.

Contoh Manifest

yaml
apiVersion: formspec.dev/v1
kind: Print
metadata: { name: receipt, module: billing }
spec:
  entity: billing.order
  output:
    format: pdf                   # pdf | thermal | dotmatrix | html
    paper: { size: A5, margin: 12mm }
  header: { logo: true, title: "Receipt {order.number}" }
  body:
    - fields: [number, paid_at, customer.name]
    - child_table: { field: items, columns: [product_id, quantity, price] }
    - totals: { field: total, format: currency }
  footer: { text: "Thank you — {tenant.name}" }

Atribut

<!-- generated:attributes -->

AtributTipeWajibContohDeskripsi
publicbooleantrueIf true (default), a route /module/print/<name> is auto-generated.
entitystringbilling.order
templatestring
outputPrintOutput
headerPrintHeader
body[]PrintBodyItem
footerPrintFooter

<!-- /generated:attributes -->

Gotchas

  • output.paper.size divalidasi terhadap formatthermal_58mm cuma valid dengan format: thermal.
  • Semua format kecuali html render server-side → hasil ke download tray. html render di browser (window.print() + CSS @media print).
  • Kertas custom custom: { width, height, unit } divalidasi saat formspec validate.
  • Print programatik: ctx.print(entity_id, "receipt") — format per-manifest Print, bukan per-panggilan.
  • Cross-ref: docs/spec/frontend/06-page-kinds.md §8 · ai_skills/formspec-kinds

Standar terbuka (CC0) dengan implementasi referensi.