Future<void> printBytes(Uint8List bytes) async { await Printing.layoutPdf(onLayout: (PdfPageFormat format) async => bytes) .catchError((onError) => throw onError); }