oria / gridx

Just another powerful Dojo grid
Other
162 stars 77 forks source link

missing resources when printing from chromium #411

Open maxnikulin opened 7 years ago

maxnikulin commented 7 years ago

Chromium (linux) does not wait for images when Window.print() is invoked. As a result a grid exported to PDF may look not so pretty as expected.

The issue may be reproduced using tests/test_grid_printer.html I use echo_sleep option in nginx to simulate some delay (1s) in loading of tests/support/data/status.png file. It real life it may happen due to network latency. Sometimes that delay is not necessary at all.

  1. Load test_grid_printer.html page
  2. Check the following options:

    • Use CSS File
    • Use Formatters

    and maybe Row Count

  3. Click Print
  4. Maximize the print popup window (it can be blocked by browser, that case enable it)
  5. Ensure that "background" is checked in the chromium print preview options.

Status icons are absent in the print preview window and it is a bug.

If Window.print() is invoked with some timeout https://github.com/oria/gridx/blob/master/support/printer.js#L93 then there is no problem with images.

It seems that the export window have to wait for some event (load?). Unfortunately it can not be done by printer.js since that script belongs to original page. Maybe a script that initiates print should be injected into the generated export page.