Coder Social home page Coder Social logo

browser-thermal-printer's Issues

Issue when importing typescript src

I would like to use this lib on my typescript project. Sadly, types are not exported.
And when i try to import from:

import ThermalPrinter, { PrinterTypes } from 'browser-thermal-printer/src/core';

My typescript fails because my project has stricter rules.

Error: node_modules/browser-thermal-printer/src/interfaces/epson/epson.ts:251:30 - error TS2769: No overload matches this call.
The last overload gave the following error.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
251 this.append(Buffer.from([type, data.length]));

Is there away to export the.d.ts files two please.

How to actually connect to the printer?

Hello,
I am developing an app and I am trying to find a way to print labels directly from browser (especially mobile devices).
I found this library but browsing the code I didn't found where you tell some kind of detail about the printer. How can the library know to which printer to connect?

config interface

How to config interface using tcp, local or selecting printer?

Printer connection question

Hi @Klemen1337 thanks for this module.

I have a question on how to ultimately send the commands to the printer.
From the code I see that you accumulate a Buffer with all the commands but how do you connect to the printer and send the buffer from the browser?

I see the Tested printers section in the README. Can you provide an example on what you're using to send the buffer commands to the printer?

ReactJs Implementation

Hello!

I was trying to implement this library in reactjs and I cannot get It working, do you have any example using reactjs?

import ThermalPrinter, { PrinterTypes, TableAlign } from "../src/core"

async function printTest() {

  const printer = new ThermalPrinter();
  printer.print("Hello World"); // Append text
  printer.println("Hello World"); // Append text with new line
}

module.exports = {
  printTest: printTest
};

I know that doesn't work because '../src/core' but if I try with

const ThermalPrinter = require('browser-thermal-printer');

It doesn't works. I got this error: TypeError: ThermalPrinter is not a constructor

Any help?

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.