printImageExample static method
Example: Print image
Implementation
static Future<void> printImageExample() async {
print('=== Image Printing Example ===');
// Initialize printer
final initialized = await PaxSdk.initializePrinter();
if (!initialized) {
print('Failed to initialize printer');
return;
}
// Create a simple test image (black and white)
// In a real app, you would load an actual image
final imageData =
List<int>.filled(384 * 200 ~/ 8, 0); // Simple black rectangle
// Print the image
final result = await PaxSdk.printImage(
imageData,
options: {
'alignment': 1, // Center
},
);
if (result['success']) {
print('Image printed successfully!');
await PaxSdk.feedPaper(pixels: 48);
} else {
print('Image print failed: ${result['error']}');
}
}