Nw.js: NW window Print Bugged

Created on 9 Apr 2017  路  5Comments  路  Source: nwjs/nw.js

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!

P2 bug triaged

Most helpful comment

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

All 5 comments

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

@Christywl @rogerwang Sorry to trouble you锛宧ow's it going?

@tangyue0924 Basically this is a Chromium upstream issue, they are not responsible this fix this issue. Roger said they are considering to fix this upstream issue but I guess its not a priority.

close as duplicate with #5111 , which is now fixed in git.

Was this page helpful?
0 / 5 - 0 ratings