onPrint method

  1. @override
Future<void> onPrint()
override

Implementation

@override
Future<void> onPrint() async {
  final pdf = pw.Document();

  pdf.addPage(
    pw.MultiPage(
      pageFormat: PdfPageFormat.a4,
      build: (context) => [pw.Text(_textContent)],
    ),
  );

  await Printing.layoutPdf(onLayout: (format) => pdf.save());
}