Open alohadance98 opened 3 months ago
Hi, First of all thank you for provide a great package. There is an issue when i print an image capture from widget when set width to container DragoUsbPrinter only print a part of the image. Here is the example code:
DragoUsbPrinter dragoUsbPrinter = DragoUsbPrinter(); ScreenshotController controller = ScreenshotController(); List<Map<String, dynamic>> devices = await DragoUsbPrinter.getUSBDeviceList(); if (devices.isNotEmpty) { Map<String, dynamic> device = devices.last; int vendorId = int.parse(device['vendorId']); int productId = int.parse(device['productId']); bool? isConnected = await dragoUsbPrinter.connect(vendorId, productId); if (isConnected != null && isConnected) { Widget container = Container( decoration: BoxDecoration(border: Border.all(color: Colors.black)), height: 1000, width: 380, child: const Column( mainAxisAlignment: MainAxisAlignment.end, children: [ Text( "TEST", style: TextStyle(color: Colors.black, fontSize: 20), ), ], ), ); Uint8List buf = await controller.captureFromWidget(container); final img.Image image = img.decodeImage(buf)!; final profile = await CapabilityProfile.load(); final generator = Generator(PaperSize.mm58, profile); List<int> data = []; data += generator.image(image); await dragoUsbPrinter.write(Uint8List.fromList(data)); await dragoUsbPrinter.close(); } }
DragoUsbPrinter only prints part of the widget above but if i remove width of container it will prints the widget with full height
this is the result when i set width and not set width for widget
Hi, First of all thank you for provide a great package. There is an issue when i print an image capture from widget when set width to container DragoUsbPrinter only print a part of the image. Here is the example code:
DragoUsbPrinter only prints part of the widget above but if i remove width of container it will prints the widget with full height