klemen1337 / browser-thermal-printer Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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.
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?
How to config interface using tcp, local or selecting printer?
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?
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.