printPriceTag static method
Implementation
static Future<String?> printPriceTag(
PriceTagData priceTag, { int copies = 1, bool downToUp = true }) async {
if (copies <= 0) {
_status = 'Copies should be between 1 and 20';
print(_status);
return _status;
}
final content = await PriceTagLayout.buildDocument(priceTag);
SewooDocument document = SewooDocument(
content: content,
downToUp: downToUp
);
final String path = await _saveDocument( document );
if ( await _checkStoragePermission() ) {
String status = 'Printing';
try {
bool success = await (_channel.invokeMethod('printImage', <String, dynamic> {
"path": path,
"width": _mm2dots( 39 ),
"height": _mm2dots( 102 ),
"copies": copies
}) as FutureOr<bool>);
status = success ? 'Success' : 'Fail: Image not found';
} on PlatformException catch (e) {
status = 'Failed: ${e.message}';
}
_status = status;
} else {
_status = 'Permission Denied';
}
return _status;
}