Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win.print will only print the parent window #7377

Closed
aam-git opened this issue Feb 15, 2020 · 3 comments
Closed

win.print will only print the parent window #7377

aam-git opened this issue Feb 15, 2020 · 3 comments

Comments

@aam-git
Copy link

aam-git commented Feb 15, 2020

NWJS Version : 0.44.1
Operating System : win-x64

Expected behavior

When I call the function below, the child window should print silently

Actual behavior

When I call the function below, the parent window prints not the child.

How to reproduce

const nwPrint = (data) => {

	nw.Window.open(`data:text/html,${encodeURI(data)}`, {focus: true}, (new_window) => {

		new_window.on('loaded', () => {

			new_window.print({
				"printer":"ZDesigner GK420d",
				"autoprint": true,
				"marginsType": 1,
				"headerFooterEnabled": false,
				"shouldPrintBackgrounds": false,
				"landscape": false,
				"mediaSize":{'name': 'CUSTOM', 'width_microns': 100000, 'height_microns': 150000, 'custom_display_name':'4x6 label', 'is_default': true},
				"preview": false
			});

		});
		
	});

}

nwPrint('Hello World');

I've tried every which way I can think of for the past few hours to make it print the child window, but its not letting me, each time I successfully mange to print, the parent window comes out.

@aam-git
Copy link
Author

aam-git commented Feb 15, 2020

Just tried it on multiple versions to try and work out where the change happened

Works fine on v0.39.3
Works fine on v0.40.2
Works fine on v0.41.3
Works fine on v0.42.0
Works fine on v0.42.2
Works fine on v0.42.3
Fails on v0.42.4
Fails on v0.42.6
Fails on v0.44.1

Looks like it has something to do with NW2 Mode in that case maybe?

@DrDoing
Copy link

DrDoing commented Mar 23, 2020

I have the same issue.

If you disable the nw2 Feature in your package.json :
{
"chromium-args": "--disable-features=nw2",
}

the print will work perfect.

In issue #7230 Roger Wang ask for blocking nw1 removel issue.
I think this issue is one.

@rogerwang
Is it possible to reproduce this issue, or do you need further information ?

@rogerwang
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants