Code Monkey home page Code Monkey logo

escpos-buffer's People

Contributors

cristiano-linvix avatar dependabot[bot] avatar maythiwat avatar mazinsw avatar noisyscanner avatar samuelcust avatar samueldurantes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

escpos-buffer's Issues

changelog

can we add a changelog?

what are the breaking changes to v4 ?

use new writeValue method

How connect to printer?

I have a printer model TM T20X from Epson, nothing happens with this function:

(async () => {
const model = new Model('TM-T20')
const connection = new InMemory()
const printer = await Printer.CONNECT(model, connection)
await printer.setColumns(56)
await printer.write('Simple Text *** ')
await printer.writeln('Bold Text -> complete line text.[]123456', Style.Bold)
await printer.writeln('Double Height', Style.DoubleHeight | Style.Bold, Align.Center)
await printer.writeln('Double Width', Style.DoubleWidth, Align.Center)
await printer.writeln('Áçênts R$ 5,00', Style.DoubleWidth | Style.DoubleHeight, Align.Center)
await printer.feed(6)
await printer.buzzer()
await printer.cutter()
await printer.drawer(Drawer.First)
process.stdout.write(connection.buffer())
})()

Provide PNGjs instance to new Image()

#8 In this pull request you support pngjs object to constructor. But when I try to give a pngjs object it throws an error. Your code not assume this object as an instance of PNG.

Publish new version to NPM

Is it possible to add a new version to NPM for the new WebUSB stuff?
Maybe this could also be something useful to go into Travis? For example, if you bump the version number it triggers a publish?

[Question] Conectar com porta serial | Connection with SERIAL port

Olá Francimar, vi que aceita uma grande variedade de impressoras que usamos aqui no Brasil.
Minha dúvida é a seguinte, é possível de utilizar essa library conectando diretamente na porta serial da impressora?
Se sim, tem um exemplo de como fazer?

-- English
Hello Francimar, I saw that you accept a wide variety of printers that we use here in Brazil.
My question is, is it possible to use this library by connecting directly to the printer's serial port?
If so, do you have an example of how to do it?

Possibility to run into react-native?

Is there a possibility to use it with react native?

Today pngjs and fs libs don't exist in react-native, maybe splitting the core into two libs, one that generates the coding part outside of the imaging part, should work.

What do you think of the idea?

windows on webusb

have you made this package work with WebUsb and Windows ?

We tried using https://zadig.akeo.ie/ to enable WinUSB drivers, but it didn't worked

do you have any tips to make this work?

we have an escpos printer connected by USB

Release v1.3.1

Doesn't look like the CI published this new version to NPM?

No new line by `writeln()` after bitmap image

Issue

After the bitmap image drawing the next writeln() command does not add a new line after the text.
But the second text is incorrectly placed directly after the first one.

Example of code with issue:

writeln('line1.');
writeln('line2.');
draw(image);
writeln('line3.');
writeln('line4.');

Example causes the output with issue:

line1.
line2.
[Image]
line3.line4.

Root cause

I have found the incorrect ESC command in draw() function after each bitmap line.

File: src/profile/index.ts

Current (incorrect implementation):

yield this.connection.write(Buffer.from('\x1BJ\x00', 'ascii'));

Should be 0x0A only:

yield this.connection.write(Buffer.from('\x0A', 'ascii'));

ESC commands documentation

Testing:

I have tested my offered change. It corrects the issue on my side.

Error on react js

import React from 'react';
import { WebUSB } from 'escpos-buffer';

./node_modules/escpos-buffer/dist/graphics/Image.js:4:0
Module not found: Can't resolve 'fs'

how can I print a inMemory buffer to a real device?

Example

const model = new Model('TM-T20');
  const connection = new InMemory();

  const printer = await Printer.CONNECT(model, connection);

  await printer.writeln('Awesome);

const buffer = connection.buffer()

How can I print a buffer to a real printer?

Preview mode

Hey there, great library, thanks for the work.

I can see that for now you have two connection types, do you plan to add others for network, bluetooth ...?
Also I was wondering how faisable it is to have a preview of the receipt. ie: connection=Image/PDF Do you know of any code able to do that ?
That would make the app much more attractive I think and would allow to print to other non escpos printers as a fallback

escpos-buffer-web with Angular and WebUSB

While testing this out I get:
Error: Failed to execute 'open' on 'USBDevice': Access denied.

Worked around this by installing the Zadig USB driver, but then I get:
ReferenceError: Buffer is not defined

Publish 2.0.1

Heya oh wonderful team 🤘
Just wanting to double check there was plans to release the new changes merged on Tuesday. Just to make sure it hadn't been forgotten - I've forgotten to do this many times myself haha!
Thanks for all your great collaboration 😊

Ability to specify height and width greater than double

Looks like the ESC/POS allows font sizes to go all the way up to 8x:
https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=34
It would be useful to have this functionality.
I am happy to put a PR in to address this - wanted to open this issue to discuss possible solutions.
Perhaps simply, the easy way would be to add to the Style enum extra sizes for height and width, but that would probably bloat it out a bit and I'm not sure I am a fan of this solution.
Other ideas:

  • A Height and Width enum - but then we would have to add those to method calls too which isn't ideal
  • Add it to the Font class - eg new Font('Font A', Height.Height8, Width.Width6) or font.height = Height.Height8 or printer.font.width = Width.Width6

bematech mp-4200 th miniprinter not workin

I cannot use bematech mp-4200 as a printer.

the problem happens in the function when trying to connect with the printer.

static async CONNECT(
    _model: SupportedModel | Model,
    connection: Connection,
  ): Promise<Printer> {
    let model: Model;
    if (typeof _model === 'string') {
      model = new Model(_model);
    } else {
      model = _model;
    }
    await connection.open();
    model.profile.connection = connection;
    await model.profile.initialize?.();
    return new Printer(model);
  }

When calling const printer = await Printer.CONNECT(model, connection); inside the CONNECT function, the open
await connection.open(); that comes from WebUsb has the param interface number with a fixed number of 0.

async open({
    configuration = 1,
    interface: interfaceNumber = 1,
  }

then, it breaks returning the same error of this issue #29.

To try to fix it, my machine has 2 interfaces. The problem is that zero doesn't work. To get around I changed the node_modules directly to 1 and the open function worked

open({ configuration = 1, interface: interfaceNumber = 1 } = {}) {

Returning and following the CONNECT function, the problem is that when calling await model.profile.initialize?.(); nothing else happens.

It has no errors or warnings.

What could be the problem? Do you have any idea how to solve it?

ControlID printer not working

ControlID not working with WebUSB

Error:

"error": {
  "stack": "Error: Failed to execute 'claimInterface' on 'USBDevice': Unable to claim interface."
},

Printer information:

"device": {
  "configuration": {
    "configurationName": null,
    "configurationValue": 1,
    "interfaces": [
      {
        "alternate": {
          "endpoints": [
            {
              "direction": "in",
              "endpointNumber": 1,
              "packetSize": 512,
              "type": "bulk"
            },
            {
              "direction": "out",
              "endpointNumber": 1,
              "packetSize": 512,
              "type": "bulk"
            }
          ]
        },
        "claimed": false,
        "interfaceNumber": 0
      },
      {
        "alternate": {
          "endpoints": [
            {
              "direction": "in",
              "endpointNumber": 3,
              "packetSize": 10,
              "type": "interrupt"
            }
          ]
        },
        "claimed": false,
        "interfaceNumber": 1
      },
      {
        "alternate": {
          "endpoints": [
            {
              "direction": "in",
              "endpointNumber": 2,
              "packetSize": 512,
              "type": "bulk"
            },
            {
              "direction": "out",
              "endpointNumber": 2,
              "packetSize": 512,
              "type": "bulk"
            }
          ]
        },
        "claimed": false,
        "interfaceNumber": 2
      }
    ]
  },
  "manufacturerName": "ControliD",
  "productName": "Print iD - Impressora Térmica não Fiscal",
  "vendorId": 12342,
  "serialNumber": "120100/0085B9"
},

Printer image:

image

Print ID error with QRCode

Olá Francimar, tudo bem?

Estou fazendo um probleminha em uma impressora Print ID com QRCode, e ela retorna um erro na hora de gerar a impressão.
Outra coisa é que a fonte da impressora está meio zoada, e com _ nos finais de linha.

Se precisar, posso ajudar na correção fornecendo acesso a impressora via suporte remoto.

--EDIT
Configurado como epson TM-T20 não acontece o erro.

--EDIT 2
Peguei a função qrcode da epson, e coloquei na controlid e resolveu!

index.ts:138 Uncaught (in promise) TypeError: QRCode.toBuffer is not a function
    at ControliD.<anonymous> (index.ts:138)
    at Generator.next (<anonymous>)
    at tslib.es6.js:76
    at new Promise (<anonymous>)
    at Module.__awaiter (tslib.es6.js:72)
    at ControliD.drawQrcode (index.ts:137)
    at ControliD.<anonymous> (ControliD.ts:23)
    at Generator.next (<anonymous>)
    at tslib.es6.js:76
    at new Promise (<anonymous>)
    at Module.__awaiter (tslib.es6.js:72)
    at ControliD.qrcode (ControliD.ts:22)
    at Printer.<anonymous> (Printer.ts:71)
    at Generator.next (<anonymous>)
    at tslib.es6.js:76
    at new Promise (<anonymous>)
    at Module.__awaiter (tslib.es6.js:72)
    at Printer.qrcode (Printer.ts:70)
    at TestPrinter (print.js:119)
    at Object.PrintReceipt (print.js:15)
    at handleTapPix (index.js:155)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070)
    at executeDispatch (react-dom.development.js:8243)
    at processDispatchQueueItemsInOrder (react-dom.development.js:8275)
    at processDispatchQueue (react-dom.development.js:8288)
    at dispatchEventsForPlugins (react-dom.development.js:8299)
    at react-dom.development.js:8508
    at batchedEventUpdates$1 (react-dom.development.js:22396)
    at batchedEventUpdates (react-dom.development.js:3745)
    at dispatchEventForPluginEventSystem (react-dom.development.js:8507)
    at attemptToDispatchEvent (react-dom.development.js:6005)
    at dispatchEvent (react-dom.development.js:5924)
    at unstable_runWithPriority (scheduler.development.js:468)
    at runWithPriority$1 (react-dom.development.js:11276)
    at discreteUpdates$1 (react-dom.development.js:22413)
    at discreteUpdates (react-dom.development.js:3756)
    at dispatchDiscreteEvent (react-dom.development.js:5889)

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.