web_uri_to_image
Render a web URL to a PNG image sized for thermal receipt printers (ESC/POS).
Designed for stable printing: control width (in printer dots), scale, and render delay.
Why this package?
Thermal printers expect a fixed pixel width (dots/line). Typical widths:
- 58mm receipts: 384 dots
- 80mm receipts: 576 dots
This plugin renders a web page at an exact width and returns PNG bytes you can feed into your ESC/POS image command pipeline.
Features
- Capture URL → PNG bytes (Uint8List)
- Specify target width in printer dots (e.g., 384/576)
- Adjustable
scale,delayMs, andtimeoutMs - Optional transparent background (useful for some layouts)
How to use
EasyLoading.show( status: 'Loading...', maskType: EasyLoadingMaskType.black, dismissOnTap: false, );
List images = <String>[];
String uri = '';
images = await WebLabelToImage.convert(
uri: uri,
duration: 1000,
scale: 1,
paperTypeName: "paperang", // paperang_lan
orderIds: [//orderIds],
);
EasyLoading.dismiss();
// นำทางต่อ
Installation
Add dependency:
flutter pub add web_uri_to_image