printPDF method
Future<bool?>
printPDF(
- String filePath,
- int rotationDegrees,
- int copies,
- String cutOption,
- bool isCollated,
- bool printTrailer,
override
printPDF() asynchronously sends a print job of the currently set PDF to the printer that the app is currently connected to and returns a Boolean value afterwards with the result of the print operation (i.e. success or failure).
Implementation
@override
Future<bool?> printPDF(String filePath, int rotationDegrees, int copies,
String cutOption, bool isCollated, bool printTrailer) async {
final fileData = await rootBundle.load(filePath);
final bytes = fileData.buffer.asUint8List();
var sendMap = <String, dynamic>{
"fileData": bytes,
"rotationDegrees": rotationDegrees,
"copies": copies,
"cutOption": cutOption,
"isCollated": isCollated,
"printTrailer": printTrailer
};
bool? printed = await methodChannel.invokeMethod<bool>('printPDF', sendMap);
return printed;
}