How to use tojocky/node-printer in meteorJS app

I am trying to use tojocky/node-printer library in meteorJS app. I did following to install

meteor npm install --save node-printer
But when I try to use it, It doesnt seem to be working.

Following is my code snippet

import { printer } from 'node-printer';
import './mainLayout.html';

  printers: function() {
    return printer.getPrinters();

I get following error

Exception in template helper: TypeError: Cannot read property 'getPrinters' of undefined
What am I missing here? Any help would be appreciated.

That’s a server-only module and it won’t work within your browser.

Thank you. Glad I didnt spend more time trying to figure this out.

Anyway I can print receipts on client side from browser?
Are there any packages that allows that.
I have seen topics claiming that People can communicate with hardware (Receipt Printer) on client side from MeteorJS.
How to achieve that? Any pointers would be appreciated.

Apart from creating a pdf (client side) on the fly, I think there are a few browser based libraries out there that make it easy for you to print a target div and signal the browser to ignore page header and footer information.

Mind you, this is not fir accessing a pronter, this is for telling the browser that it should pront something.

Afaik, browsers don’t let you arbitrarily access system resources/hardware. There used to be plugin (flash/java) based alternatives in the past and they may still exist, especially java based ones but that would be a little less tasteful, more intrusiv than letting the browser handle it.

Can you, please, give me soma names?

Unfortunately, I don’t have a particular one in mind :expressionless: You’ll need to
research that yourself on github/npm/so etc.

Thanks @serkandurusoy for your help.
@none for pdf creation I found this one

@serkandurusoy Yeah thats what I was suspecting. But I saw a video there where a guy mentioned that he created a POS solution using meteorJS and want to figure out how does he connect to printer and cash register etc from browser.

Look at the 8:30 mark in the video. Does he mean that he is just sending div with bell character to printer in that case?

Thanks a ton for this help!

A server might be connected to a cash register.

The server might be connected to a network resource that can send bell messages to the cash register.

The app might be using a flash plugin, a java applet or a browser extension/plugin to interface with the printer.

Otherwise, by security design, your app can not directly interface with the printers from the browser.