invoice static method

Future<Document> invoice({
  1. required InvoiceData data,
  2. ThemeData? theme,
  3. bool pageLandscape = false,
  4. PdfPageFormat? pageFormat,
})

Builds a minimal invoice PDF from structured data.

Uses the same rendering pipeline as generate: PdfHeader, a plain-text PdfPlainTextBlock for “Bill To”, PdfTable for line items, and PdfFooter for total plus optional amount-in-words and footer notes. Throws ArgumentError when validation fails (empty items, empty names, or non-finite / out of range quantities and prices).

Optional theme, pageLandscape, and pageFormat behave like generate.

Implementation

static Future<pw.Document> invoice({
  required InvoiceData data,
  pw.ThemeData? theme,
  bool pageLandscape = false,
  PdfPageFormat? pageFormat,
}) async {
  InvoiceValidator.validate(data);
  return generate(
    header: InvoicePdfAdapter.buildHeader(data),
    sections: InvoicePdfAdapter.buildSections(data),
    footer: InvoicePdfAdapter.buildFooter(data),
    theme: theme,
    pageLandscape: pageLandscape,
    pageFormat: pageFormat,
  );
}