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.

NW window Print Bugged

See original GitHub issue

0.21.3-sdk Windows: 10/7 Node: 6.9.5 Chrome: 56.0.2924.87(64-bit)

Git(OS-China) Project: Hongfund-DeskTop

Reproduction: Window.get().print();

let nw = require('nw.gui').Window;
let printer = '';
let printFile = ({
	'autoprint': true,
	'mediaSize': {'name': 'CUSTOM', 'width_microns': 279400, 'height_microns': 215900, 'custom_display_name':'Letter', 'is_default': true},
	marginsType: 1,
	headerFooterEnabled : false,
	landscape: false,
	shouldPrintBackgrounds: false,
	copies: 0,
	headerString: '',
	footerString: ''
});
nw.get().print(printFile);

<style>
@media print{
    .nextPage{
	page-break-after: always
    }
}
</style>

Using all above script commands:

printFile.autoprint == true It will be just 2 pages the printer can be printed, the other pages over 2 will be blank papers. And the waiting time is so long for about 20-60 seconds. printFile.autoprint == false The print window of Chrome will be show, and everything will be correctly. But that window should be hidden from my project in my requirement.

My end goal is to hide the Chrome’s print window. Of course, the print functions can be run correctly and quickly. So, the ‘autoprint’ will be very important.

autoprint autoprint.pdf

!autoprint (use window.print()) !autoprint.pdf

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Christywlcommented, Apr 10, 2017

I can reproduce this issue on Windows with nwjs-sdk-v0.21.5. But it works fine on Linux.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug]: window.print does nothing when printing a page with ...
Executing window.print() should open the printing settings dialog and execute the print of the page. Actual Behavior. When calling window.print ...
Read more >
Window.print() Is "Snagged" in JavaScript when a <video ...
Issue 141633: Window.print() Is "Snagged" in JavaScript when a <video> element is in the DOM. Reported by schedule jmk...@gmail.com jmk.
Read more >
Electron / Nativefier Web App - new window print problem ...
I come across problem with printing, a problem manifests only when trying to open a new window with preview for print.
Read more >
Microsoft fixed a weird printing bug that wouldn't let you ...
An upgrade safeguard hold relating to printing issues in Windows 11 22H2 has been removed, letting more people try the new version of...
Read more >
Window.print() Is Not Working As Expected - Caspio Forum
I have a simple HTML code to print the page. Below is the code: <!DOCTYPE html>. <html>. <head>. <script>. function printPage().
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