Giter Club home page Giter Club logo

node-thermal-printer's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

node-thermal-printer's Issues

Can't connect to printer Epson TM-20ii

Hello,

I amtrying to connect to a Epson TM-20ii thermal printer through usbbut all i get is false when i run isPrinterConnected. Any solution that i could try to conenect to the printer? I have tryied changing the interfacein init but with no luck.

Thank you for your time

Star TSP100 (143 LAN) Not printing

Hi there -
I'm new to thermal printers. The printer I'm trying to use is a Star TSP100IIILAN model (143 LAN). If I specify in the example.js options an interface of "tcp://10.0.1.15:9100", the net interface will successfully connect to the printer. The buffer is sent to the printer. Then there's a data event which returns "#�".

However, the printer does nothing.

I don't know if this is an issue with node-thermal-printer; I think I'm doing something wrong.

Perhaps this particular STAR printer model needs different commands sent to it than what are specified in this repo's lib/star.js?

Can you point me in the right direction? What do you think I'm doing wrong?

fs.writeFile is not a function

Hai,
I used node thermal printer for access EPSON printer in my application.This npm is dependent on

fs npm

but when i execute printer, i got error like this fs.writeFile is not a function.

printer.init({ type: 'epson', interface: '\USB\VID_04B8&PID_0E15' }); console.log("print",printer); if(printer.isPrinterConnected){ console.log('isPrinterConnected'); } else{ console.log('not Connected'); } printer.cut(); try { printer.execute() } catch (error) { console.log("Print failed", error); }

Can we convert this module with react native compatible

I have a mobile application in iOS and Android and i want to manage printer via my mobile using react native technologies. so can we convert this module as react native module. if not so what are the reason if possible

2 printers connected

I have a problem.. i need to connect two thermal in the same computer.. do you have an example about it ?

Question: Dot Matrix Support

Hello, I'm working on web app and now stuck on how to print on dot matrix printer. Does this library support dot matrix printer? I use Epson LX 310 for the printer.

Thanks!

printer.isPrinterConnected() always returns true even the printer is OFF.

I have printed the bill using USB printer. But when I turn off the printer, it's not return the "false" value for the printer.isPrinterConnected(). It is always prints the "Print done" on console.

var printer = require("node-thermal-printer");
  printer.init({
        type: "epson",
        interface: "printer:RONGTA RP80 Printer"
    });
    printer.setTextDoubleWidth();
    printer.bold(true);
    printer.println("Hello World!");
    printer.println("********");

    printer.isPrinterConnected( function(isConnected){
        console.log(isConnected);
        if(isConnected){
            printer.cut();
                printer.execute(function(err){
                    if (err) {
                        console.error("Print failed", err);
                    } else {
                        console.log("Print done");
                    }
                });
        }else{
            alert("printer is not connected/Off! Please check it!.");
        }
    });

Interface Issue

What should be the interface name given in windows computer..?
Can someone please help me out thanx!!

No printing

Hello!

The console shows:

Printer connected: true
Print done

But nothing is printed.

Thank you very much.

Using Node.js 7.4.0.

expose printBarcode?

if code128 only works on star and printBarcode only works on epson, it would be nice to have printBarcode documented like code128

print via bluetooth

hello, thank you for your project. do it support print via star bluetooth and zebra bluetooth?
thank you

Expose module for partial cut

I see that the config file has partial cut config but is not exposed via any functions in the module. How can I use the partial cut feature?

printer.isPrinterConnected() return "not connected" alert two times

I am printing over WiFi.
If the printer is off, the callback is triggered two times. Here "printer is not connected! Please check it!." alert is showing two times.

Sometimes, Even In the printer ON condition, "printer is not connected! Please check it!." alert is showing after that printing has happening.(Print done alert).

Does it actual behavior or bug?

`printer.isPrinterConnected(function(isConnected){
  console.log(isConnected);
  if(isConnected){
    printer.cut();
    printer.execute(function(err){
      if (err) {
        alert("Print failed", err);
      }else{
        alert("Print done");
      }
    });
  }else{
    alert("printer is not connected! Please check it!.");
  }
});`

Thanks.

Image printing

Can you please provide help on printing of images in this printer? using the same API?

Other printing is working fine, but we need to print images. Please help.

Regards
Ali

messy code for chinese

when i want to print chinese, thr print result is messy code,how to solve this?thanks,i am new to nodejs.

Print barcode

Hi
I'm not able to print barcode using this library or project. I'm using Zebra TLP 2844 barcode printer.

Any help will be appreciated

Need help with border for table

Hi, this works very well along with printer package for Windows, including QR and Barcode.
Tested on Epson TM-T82. However, am not able to find any doc on how to draw border for table.
Please help.
Thank you.

Table widths don't account for type B font

Hello!

TLDR; What's broken?
The table generator does not account for the extra line length when using Font B

More Info
When Font B is used each line is an extra 15 characters wide and the line height remains the same. The problem is that the table generator does not account for the extra line length.

I'm using the Epson TM-T88V, so the 15 character difference might be different on other printers (maybe even less?)

From what it looks like, fixing this would require:

  • Width configuration for each of the two font types
  • Tracking which font mode we are in (note: setting text to normal resets font type)
  • Adjusting table width and padding calculation to use the correct width configuration.

I wanted to get this tracked in an issue and will happily knock this out in a PR, but probably won't have time for several weeks though.

Compile the package down to ES5

Problem
Uglify doesn't understand the ES6 syntax.
let i = "QRCODE_CELLSIZE_".concat(settings.cellSize.toString())

Explanation
I'm building a cross-platform desktop app using electron and react and I'm using npm package 'node-thermal-printer' for usb thermal printer. The printer code works fine in the places where react-scripts build doesn't involve like

  • static .js (public folder) and linked to index.html (renderer process)
  • electron's main process (main.js)

But the build fails, when I add the same code in src/index.js where react-scripts build failed with error code ELIFECYCLE, errno 1

Issue Reference
facebook/create-react-app#2640

Expected Solution
The library needs to be compiled down to ES5 before publishing

Suggested Work Around
It's mandate for user to use babel for transpilation at their end.

is MacOS Support?

when i use in MacOS, execute command "node example.js", Espon Printer is Connected my mac by use interface. the console print
"Not yet supported
false"

printer.openCashDrawer() not opening drawer

I'm trying to open the cash drawer however nothing is happening.

Code:

var printer = require("node-thermal-printer")

printer.init({
  type: printer.printerTypes.STAR,
  interface: 'printer:Star TSP100 Tear Bar (TSP113)',
  characterSet: 'UTF8'
})    

printer.alignCenter()
printer.isPrinterConnected( function(isConnected){ console.log(isConnected) } )
printer.println("Hello Mr. Santiago")
printer.code128("20101", {
  height: 50,
  text: 1
})
printer.cut()
printer.openCashDrawer()
printer.execute( function(err){ if(err) console.log(err) } )

Everything else seems to work though. The printer is a "Star TSP100 Tear Bar (TSP113)" is connected via USB to the computer and the cashdrawer is connected to the printer via phone-jack (I guess it is called).

network init

You can add as feature connect via network?
not only by printing through usb

Can't print images/barcodes/QR codes

I have successfully printed texts and was able to confirm that most of the text options work but...

I noticed that I can't print anything else. I tried transferring an image onto my raspberry pi which is the computer utilizing the thermal printer, it was in PNG format. I then followed the examples and it just won't print out the image. It did move the thermal paper but nothing was printed.

When I tried printing out barcodes -- same result.. barcodes. I tried printing different formats.

I then moved onto the QR code hoping that would work but... no luck.

Publish a new version?

Hi guys,

Thanks for the package. It seems there is an update 1 month ago about node-png -> pgnjs, but no new version is pushed to npm.

Could you publish it?

Thanks

I get stocked in printer.execute(...)

Hello, i get stocked in printer.execute()
this is my code

var printer = require("node-thermal-printer");

printer.init({
type: 'epson',
interface: '/dev/usb/lp0'
});

printer.println("Helloworld");
printer.execute(function(err){
console.log("enters");
if (err) {
console.error("Print failed", err);
} else {
console.log("Print done");
}
printer.clear();
});

The program dont execute the line "console.log("enters");"

Windows Printer Star

printer.init({
    type: 'star',
    interface: 'tcp://192.168.1.10:9100',
    characterSet: 'JAPANESE',
    removeSpecialCharacters: false,
    replaceSpecialCharacters: true,
    extraSpecialCharacters:{'円':163}
})

printer.isPrinterConnected( function(isConnected){
    console.log('Printer is connected: ', isConnected)
} )

printer.alignCenter()

printer.print("日本は素晴らしい")
printer.println("Test")
printer.println("Qrcode 128")
printer.code128("granpark")
printer.cut()
printer.execute(function (e) {
    if (e)
    {
        console.log("Print Failed:", e)
    }
    else
    {
        console.log("Printed")
    }
})

This is my code, I would love to know what are the interfaces and how we set one, because I believe I am missing something, However the console does print "Printer is connected: true" but still it isn't printing.

Start TSP100III wifi printer says connected but cannot print

Hi,

I couldn't make my new Star printer print. here is the code:

printer.init({
            type: printer.printerTypes.STAR,  // 'star' or 'epson'
            interface: "tcp://192.168.2.8:9100",
            width: 48,                         // Number of characters in one line (default 48)
            characterSet: 'SLOVENIA',          // Character set default SLOVENIA
            removeSpecialCharacters: false,    // Removes special characters - default: false
            replaceSpecialCharacters: true,    // Replaces special characters listed in config files - default: true
            // lineChar: "=",                  // Use custom character for drawing lines
            ip: "localhost",                // Ethernet printing IP
            port: 9001                      // Ethernet printing PORT
        });

        printer.alignCenter();
        printer.println("Hello world");
        printer.cut();
        printer.execute(function (err) {
            if (err) {
                console.error("Print failed", err);
                reject(err);
            } else {
                console.log("Print done");
                return resolve(true);

            }
        });

It writes "Print Done" to to console but never prints actually. Is there anyone who faced the same problem?

Using this Module in Ember Js

Hello, please i have tried to import this module into an ember Js app using ember-browserify on a macOs laptop. The import but i got this issue when i tried to execute printer commands following the example provide on the README.

index.js:53 Uncaught TypeError: fs.writeFile is not a function

Please how can i resolve this?

Thank you.

Special Characters not displaying properly

I've had to manually add

specialCharacters: { "£": 35, "@": 64 }

to epsonConfig to enable these special characters. Can there not be a way to extend and support our own character set?

CONNECTION REFUSED

Hi,

Thanks for this npm package. I run the node code using "sudo", but I received the following error.
( I have used "star" printer: TSP100III)
Any suggestions, please?

Output:
Printer is connected: true
Print Failed: { Error: connect ECONNREFUSED 192.168.1.157:9100
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '192.168.1.157',
port: 9100 }

Not printing

I'm not able to print anything, using Zebra TLP 2844 printer.

Linux problem printer port /dev/usb/lpN

Hi,
I'm facing a problem I can't solve. Each time I boot my Ubuntu Mate 18.04 systema, port for usb printer (Epson TM-T20II) changes,

currently it's
crw-rw---- 1 root lp 180, 1 may 8 12:15 lp1

but if I reboot, it can change to lp0 or lp2 or anything else [0-9]...

I have added a dev rule:
$ cat /etc/udev/rules.d/99-myprinters.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="0e15", ATTRS{serial}=="544338593290260000", GROUP="lp", OWNER="username", MODE="0660", SYMLINK+="printer"

and symlink is created as follows
ls -l /dev/printer
lrwxrwxrwx 1 root root 15 may 8 12:15 /dev/printer -> bus/usb/001/005

if I do:
$ echo "test" >> /dev/usb/lp0
it prints ok, but
$ echo "test" >> /dev/printer
gives an error.

I'm thinking about creating a script in javascript to check all ports[0-9] and keep the one responding as there's only 1 printer in this system but I would like the OS to solve this issue as I think this can be solved as this.
Has someone faced this problem? Could it be solved disabling upnp in the BIOS?

Regards,

How to print a html element?

Hi all,
How can I use this module to print a html element?kindly help me to do that
P.S:
I am using Angular JS as front end I need to print a particular div

PNG Image ends up with visible vertical lines in it

I'm trying to print two different PNGs and have so far tried printing them on two different STAR printers. And they end up printing, albeit with very visible vertical lines in them. Saving the png before the printing process of converting it to an image buffer for the star printer does not produce those lines, so I believe there might be an issue with the conversion to buffer data.

Example PNG file:
This example image is what I'm printing

Result:
This is the example result

Any way of fixing this or anybody else who has encountered this?

net issue

I'm trying to connect to an Epson network printer however I'm getting the following error

PS D:\Development\test\print-test> node .\app.js
net.js:641
throw new TypeError('invalid data');
^

TypeError: invalid data
at Socket.write (net.js:641:11)
at Object.module.exports.execute (D:\Development\test\print-test\node_modules\node-thermal-printer\node-thermal-printer.js:35:15)
at Object. (D:\Development\test\print-test\app.js:15:9)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3

My JS

const printer = require("node-thermal-printer");

printer.init({
    type: "epson",
    characterSet: "UK",
    interface: '/dev/usb/lp0',
    ip: "192.168.100.252",
    port: 9100
});

printer.isPrinterConnected(function(response){
    console.log(response);
});

printer.execute();

Am I doing something wrong?

Print Chinese Garbled!

I want to print chinese but print out the Garbled.
English Is OK.

this is my code:

var printers = require("node-thermal-printer");
printers.init({
type: 'epson',
interface: 'printer:' + printer.getPrinters()[0].name,
characterSet:'CHINA'
});
printers.alignCenter();
printers.println(iconv.encode('--------测试打印----------','GBK'));
printers.println(iconv.encode('--------测试打印----------','UTF-8'));
printers.println('--------测试打印----------');
printers.println('hello');

printers.execute( function(err){
console.dir(err);
});

Font size issue

Can I have bigger size for the font?
I want the font size is bigger than quad area.

Thank you so much!!!

tableCustom - Same character is printed in first and second line, if the text is not accommodate in first line

Hi,
I have the table with three columns like Column1, Column2, Column3.
If the text of column has more characters, it prints the last character of first line in first character of second line ie same character printed twice.
EXAMPLE:
Expected Output :
Chicken Fried Rice With Curry 1 100
Actual Output :
Chicken Fried Rice With C 1 100
Curry

In above, the "C" character printed twice.

If I change the line number 296 from "obj.text = obj.originalText.substring(cellWidth-1);" to "obj.text = obj.originalText.substring(cellWidth);" in tableCustom function of core.js file , it works as expected.

if(tooLong){ secondLineEnabled = true; //obj.text = obj.originalText.substring(cellWidth-1); obj.text = obj.originalText.substring(cellWidth); secondLine.push(obj); } else { obj.text = ""; secondLine.push(obj); }

Please comment on this.

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.