0

I am working on POS applicatoin using Electron with Reactjs. Is there any way to print a html layout silently(without showing preview). Tried with node-printer module but not able to print html format. I have tried with below code:

var avlblePrinter = Printer.list(); 
      var printer = new Printer.default(avlblePrinter[n]);     
      var text = '<p style="color: #00b9f5">Print text directly</p>, when needed: e.g. barcode printers';
      var jobFromText = printer.printText(text);

Any help would be highly appreciable.

  • I see this is your first Question on Stack Overflow, welcome! Please provide some code so we can see what you have tried and better understand the context of your question, which in turn will help us out to help you. Also see [How To ask](http://stackoverflow.com/help/how-to-ask) on how to ask better question which lead to better answers. – Raymond Jan 17 '17 at 09:32
  • We can assume that `n` is actually set in your code? Additionally, I was unable to find the `printText` method in the modules source-code, are you following a tutorial? – Jens Habegger Jan 18 '17 at 06:31
  • `n` is number of printer from `Array` of printers. https://github.com/alepee/node-printer using this one.. – Praveen Tripathi Jan 19 '17 at 06:07
  • FWIW, some receipt printers actually can print HTML directly (after sending them a command to switch to HTML mode). You can even stile the output using CSS. But this is, of course, very printer model specific. – Marc Balmer Jan 29 '17 at 08:57

0 Answers0