Giter Club home page Giter Club logo

Comments (6)

receiptline avatar receiptline commented on May 10, 2024

Thank you for using receiptline.

You can print with TM-T88V.
In order to print with the designer, please edit printer.json.
Then, type tm_series1 in the text box and send.

"tm_series1": {
    "host": "x.x.x.x",
    "port": 9100,
    ...
},

The following code is an example of printing.

const net = require('net');
const receiptline = require('receiptline');

const data= 'hello, world!';

const printer = {
    host: 'x.x.x.x',
    port: 9100,
    cpl: 42,
    encoding: 'cp437',
    upsideDown: false,
    gamma: 1.8,
    command: 'escpos'
};

const socket = net.connect(printer.port, printer.host, () => {
    socket.end(receiptline.transform(data, printer), 'binary');
});
socket.on('error', err => {
    console.log(err.message);
});

from receiptline.

Bilal-S avatar Bilal-S commented on May 10, 2024

Thanks.
I can work with this.
What is the best way of using the printers.json file in the distribution?
Is this a list of example printers that can be supported with their settings?

from receiptline.

receiptline avatar receiptline commented on May 10, 2024

Instructions for printer.json can be found in "ReceiptLine Designer" in README.md.

Most of the items are the same as the printer parameter of the receiptline.transform() method.

Thanks!

from receiptline.

Bilal-S avatar Bilal-S commented on May 10, 2024

@receiptline thank you for clarifying.
I am trying to translate this for browser and also have looked into the example en.html file in this package.
I can render the receipt in browser but do not see a way to send to printer from browser.
The net module is not available in browser only in nodejs. Is there an alternate way to send it to printer via IP?
Is there a complete browser print example I have overlooked in the package?

from receiptline.

receiptline avatar receiptline commented on May 10, 2024

How about the Web Serial API?
https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API

TM Virtual Port Driver
https://download.epson-biz.com/modules/pos/index.php?page=single_soft&cid=6481

// receiptline
const command = receiptline.transform(text, printer);
// navigator.serial
const port = await navigator.serial.requestPort();
// open the port
await port.open(options);
// get the writer
const writer = port.writable.getWriter();
// convert command string to Uint8Array
const binary = ...
// write Uint8Array
await writer.write(binary);
// close the writer
await writer.close();
// close the port
await port.close();

Thanks.

from receiptline.

Bilal-S avatar Bilal-S commented on May 10, 2024

Thanks.

from receiptline.

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.