Nw.js: Print api multiple page print bug

Created on 15 Jul 2016  路  12Comments  路  Source: nwjs/nw.js

Hello,
If i try to print a document which will be on multiple pages, pages after page 2 will be blank.

Test case:
HTML:

<html>
<head>
<style type="text/css">
  .page {
      width: 210mm;
      height: 297mm;
      padding: 50px;
  }
</style>
</head>
<body>
  <div class="page">page1</div>
  <div class="page">page2</div>
  <div class="page">page3</div>
  <div class="page">page4</div>
  <div class="page">page5</div>
</body>
</html>

Then i call the print with:

nw.Window.get().print({
                    "printer": "HP LaserJet P2035",
                    "marginsType": 3,
                    "marginsCustom": { "marginBottom": 0, "marginLeft": 0, "marginRight": 0, "marginTop": 0 },
                    "mediaSize": { "name": "test", "width_microns": 210000, "height_microns": 297000, "custom_display_name": "test", "is_default": true }
                });

Win 10, Tried with multiple different printers and nw.js versions, same result.

If i print it with window.print() it works as it should.

Most helpful comment

reopen as we may fix the upstream bug.

All 12 comments

try this:

nw.Window.get().print({
"printer": "HP LaserJet P2035",
"marginsType": 2,
"mediaSize": { "name": "test", "width_microns": 210000, "height_microns": 297000, "custom_display_name": "test", "is_default": true }
});

@zytse same result, after page 2 the pages are blank

@kailniris I'm afraid this is a bug in upstream. The silent print function uses the same logic with "kiosk printing" in upstream. If you launch Chrome browser with --kiosk-printing argument, then print your page with 'window.print()', the same bug is found.

I suggest reporting this issue to upstream.

btw, it works well if you prints to PDF. A similar upstream issue is https://bugs.chromium.org/p/chromium/issues/detail?id=488697

@rogerwang Okey, thanks for confirming it.

If anyone is interested this bug can be avoided if you print one page at a time with a loop.

Please star the upstream issue so it can be promoted there.

Stared it, thanks your Roger!

reopen as we may fix the upstream bug.

@rogerwang THAT would be AWESOME! Because the chromium team is completely ignoring this issue for like 3 years from now.

@rogerwang 锛宑an you share the plan about this bug?thank you!

Upstream just fixed the bug in Chromium 62, which will be available in NW 0.26.

As upstream backported the fix to m61, the issue is now fixed in nw25 branch and will be released with 0.25.0-beta1 soon.

Was this page helpful?
0 / 5 - 0 ratings