---
name: "pdfmake-declarative-client-pdf"
description: "Generate pixel-perfect multi-page PDF documents, invoices, and reports using declarative JSON."
metadata:
  author: "Bartek Pampuch"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "generate invoice pdf pdfmake"
  - "pdfmake table styling"
  - "multi-page pdf page numbers"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# pdfmake Declarative Client & Server Document Generation

Generates PDFs with pdfmake: defining document structures (docDefinition), headers and footers with dynamic page numbers, tables with column widths and border styling, styling hierarchies, and downloading/streaming PDFs.

## When to Invoke
Invoke this skill whenever you need to:
- generate invoice pdf pdfmake
- pdfmake table styling
- multi-page pdf page numbers

## Execution SOP & Rules
1. Define document definition: const docDefinition = { content: [...], styles: { header: { fontSize: 18, bold: true } } }.
2. Define tables: { table: { headerRows: 1, widths: ['*', 'auto', 100], body: [...] } }.
3. Client generation: pdfMake.createPdf(docDefinition).download('invoice.pdf').
4. Server streaming: const pdfDoc = printer.createPdfKitDocument(docDefinition); pdfDoc.pipe(res); pdfDoc.end().

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
