question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autoprint is not completely silent

See original GitHub issue

NWJS Version : 0.26.3 Operating System : Mac OS 10.13

Expected behavior

When the main window is hidden, printing with autoprint: true should send document to printer quietly without any pop ups.

Actual behavior

Main window appears on screen, print preview dialog flashes momentarily, then the printing starts.

How to reproduce

I created an app that sits in system tray and waits for specific data. When it gets that data, it prints a label on a label printer attached directly to the computer. To mitigate the problem somewhat, I added win.hide() right after printing. It hides the window no problem, however during the brief moment while the main window appears, it takes the focus away from whatever app it was in before. Is it possible to keep the main window always hidden? Or to print from some background window that is never visible in the first place?

package.json:

{
  "name": "helloworld",
  "main": "index.html",
  "window": {
  	"show": false,
  	"show_in_taskbar": false
  }
}

relevant part of index.html:

win.print({
	autoprint: true, // do not display confirmation dialog
	printer: printer.deviceName,
	headerFooterEnabled: false,
	landscape: true,
	marginsType: 1, 
	mediaSize:{'name': 'Label', 'width_microns': 29000, 'height_microns': 89000, 'custom_display_name':'Label', 'is_default': true}
});
win.hide();

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
mkazlauskascommented, Feb 13, 2018

It would be great if anyone could give us a rough estimate for this to be fixed. It’s a pretty important issue for our use case (kiosk). I can see it’s currently labeled as P3 which doesn’t look very promising.

1reaction
rogerwangcommented, Jan 16, 2020

This is fixed in git and will be available in the next nightly build of 0.44 branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome settings for silent printing - Brightpearl Help Center
Enable auto print​​ In Chrome this is called "silent printing" or "kiosk printing". After creating the desktop shortcut, right click the shortcut ...
Read more >
How to use Auto-Print feature with the web application?
Below are steps to Enable Silent Print for different browsers. Chrome and Edge: In Chrome and Edge this feature is called"silent printing"or" ...
Read more >
Setting Up Auto Print for Labels in Google Chrome
Silent printing means printing (particularly receipt printing) 'automatically', either by bypassing the print dialog altogether, or automatically 'printing' ...
Read more >
Silent printing in electron - node.js - Stack Overflow
In electron you have to load your content to print it. Since you want it to be "silent" you have to load it...
Read more >
Having chrome auto print without setup options - Google Groups
The user does not have to make any decisions, they just scan, peel and affix. What we need for this is fully automatic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found