【问题标题】:Is there anyway can I solve the images issues printing out on pos system via flutter?无论如何,我可以通过颤振解决在 pos 系统上打印的图像问题吗?
【发布时间】:2021-11-27 03:37:51
【问题描述】:

我可以在收据纸上打印我的图像,但我面临的问题是图像是一行一行的,这是个问题。

下面是我的代码

final ByteData data = await rootBundle.load('assets/logo1.png');
    final Uint8List buffer= data.buffer.asUint8List();
    final  image = decodeImage(buffer);

    bytes += generator.image(image);

这是打印出来的结果。

【问题讨论】:

标签: flutter pos


【解决方案1】:

使用此功能:

  initSavetoPath() async {
    //read and write
    //image max 300px X 300px
    final filename = 'logo_a.png';
    var bytes = await rootBundle.load("assets/images/logo_a.png");
    String dir = (await getApplicationDocumentsDirectory()).path;
    writeToFile(bytes, '$dir/$filename');
    setState(() {
      pathImage = '$dir/$filename';
    });
  }

查看这个包:点击here

【讨论】:

    猜你喜欢
    • 2021-11-26
    • 2020-01-16
    • 2018-08-29
    • 2021-06-12
    • 1970-01-01
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多