sendCpclToPrinter method
Sends CPCL code to the printer
macAddress MAC address of the printer
cpclData CPCL code
charsetName Character set name (e.g., "UTF-8", "ISO-8859-1")
Returns result message if successful, throws an error if failed
Implementation
Future<String> sendCpclToPrinter(String macAddress, String cpclData, String charsetName) async {
if (macAddress.isEmpty) {
throw Exception("MAC address cannot be empty.");
}
try {
final String finalCpclToSend = cpclData;
final String result = await _channel.invokeMethod('printLabelCpcl', {'address': macAddress, 'data': finalCpclToSend, 'charsetName': charsetName});
return result;
} on PlatformException catch (e) {
throw Exception("Print Error (${e.code}): ${e.message}");
}
}