Git Product home page Git Product logo

Comments (7)

MarcoGolin avatar MarcoGolin commented on August 17, 2024 5

I need that function too

from esc_pos_utils.

Abdulazeezvp avatar Abdulazeezvp commented on August 17, 2024 2

@samo92 my suggestion is, you can use pos_printer_manager(git repo) (In pub.dev) package, which is a intergrated solution for usb, bluetooth and network. And its working good.
(Pos printer manager is devleoped with help of utils package).
In some new printers, you might have to use image bit raster option.

from esc_pos_utils.

A1000carZ avatar A1000carZ commented on August 17, 2024

Same request

from esc_pos_utils.

denisrudnei avatar denisrudnei commented on August 17, 2024

In order to print via USB, simply write the return as if it were in a file.

Linux:

File('/dev/usb/lp0').writeAsBytes(bytes);

Windows:

 File('\\computer-name\share').writeAsBytes(bytes);

I'm using this method to communicate with the printer

Video with the system working like this: https://www.youtube.com/watch?v=NZngrlGkISU

from esc_pos_utils.

Abdulazeezvp avatar Abdulazeezvp commented on August 17, 2024

Using Flutter usb printer package we can print with ESC pos printer, but problem is its not working good for images as expected, Don't know whether its the problem with esc_pos_utils package or flutter usb printer package.
we can print as follows:

///list connected printers using flutter usb package
static Future<List> getAllUsbDevices() async {
    List<Map<String, dynamic>> results = [];
    results = await FlutterUsbPrinter.getUSBDeviceList();
    return results;
  }

///connect to a printer like this
 static Future<bool> connectUsbPrinter(
      {required String vendorId, required String productId}) async {
    bool? returned;
    try {
      returned = await flutterUsbPrinter.connect(
          int.parse(vendorId), int.parse(productId));
      log('device connecetd');
    } catch (e) {
      returned = false;
      log(e.toString());
      //response = 'Failed to get platform version.';
    }
    return returned ?? false;
  }

///prepare message using this package(esc pos utils)


  static Future<List<int>> prepareMessage() async {
  
    final profile = await CapabilityProfile.load();
    late final Generator generator;
      generator = Generator(PaperSize.mm58, profile);
    List<int> bytes = [];
    bytes += generator.text('Aa Bb Cc Dd Ee Ff Gg Hh');
    bytes += generator.cut(mode: PosCutMode.partial);
    return bytes;
  }

///print message with help of flutter usb printer package.
 static Future<void> doPrint() async {
    List<int> list = await prepareMessage();
        try {
      await flutterUsbPrinter.write(Uint8List.fromList(list));
    } catch (e) {
      log('catch ' + e.toString());
    }
  }

from esc_pos_utils.

samo92 avatar samo92 commented on August 17, 2024

Hi everyone, I have the same problem too, does anyone have a suggestion regarding this issue? My printer is an Epson TM-T88V, and it only has an USB and ecom port to communicate with my computer.

from esc_pos_utils.

samo92 avatar samo92 commented on August 17, 2024

Oh noooo! flutter web is not supported, i make a quick sample to test the repo.

from esc_pos_utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.