New issue
Advanced search Search tips

Issue 903680 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 7
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Print Preview should handle no printers case gracefully.

Project Member Reported by rbpotter@chromium.org, Nov 9

Issue description

Currently Print Preview spins forever if no printers are found and the PDF printer is disabled (e.g. in a kiosk app). Print Preview should detect that no printers are available and the PDF printer does not exist and handle this gracefully somehow.
 
We can probably test this on other platforms as well by making all printer handlers return 0 printers. We can also simulate this by applying a bad policy.

Can we handle it by just defining a dummy printer in JS? Let the user preview, but not print.
Cc: namratakannan@chromium.org
Owner: rbpotter@chromium.org
Status: Started (was: Untriaged)
See attached screenshot for proposed solution, following the suggestion in comment 1 to allow a preview but not print, and to indicate to the user that there are no print destinations using an existing "no destinations found" string.

+namratakannan@ - WDYT? Any suggestions for the icon/string/etc? This case should be pretty rare but it would be nice to handle it better than we do currently (i.e. print preview spinning/loading forever).
NoDestinationsFound.png
105 KB View Download
Does this happen on load of print preview? Can the user still select destination by clicking "Change"? If not, maybe we only show the "No destinations found" string and don't offer the ability to change?
Yes, this happens on load - Print Preview runs through a sequence of defaults/fallback printers at startup, but sometimes there just are no printers at all, if PDF printing is disabled. In the build that I generated the screenshot with, the user can click "Change", which opens the destinations dialog, and the dialog also shows no printers found to select from.

We can certainly disable the "Change" button for this case. Was not sure if it would be good for users to be able to click the button and see that there are no printers in the dialog. If you think the string in the main panel is adequate to indicate the issue, disabling "Change" SGTM.
Updated screenshot attached.
NoDestinationsUpdated.png
107 KB View Download
Just realized you may have meant to hide the Change button, instead of disabling it. See attached screenshot for that option. The downside to this is the elements below the button shift on load, because the button is visible but disabled at first while we are still trying to load printers and then disappears when the "No destinations found" loads in. Which do you think is preferable?
NoDestinationsHideButton.png
105 KB View Download
Lets's keep it disabled then (avoiding moving things around). However, I notice there is no way for them to switch to system dialog? Why is that?
Screenshots are from Chrome OS (VM), so no system dialog available.
Cc: dpa...@chromium.org
namratakannan@ - One additional option. In this case we do not show the preview or allow the user to change the controls, but instead just display the error message (LMK if you think the error messages in the destination settings and preview area should be different).

Note that this screenshot is on Linux, so "Print with system dialog" is available.
ScreenshotNoDestinations3.png
26.6 KB View Download
Ah got it..I think its ok to show the preview, if we are disabling the remaining controls that are not applicable (as in the example above).
This indicates that while the preview works, the user can't print cause no destinations are available (vs we are unable to generate a preview)

Comment 11 Deleted

It is a bit easier to implement this (and disable the extra controls) if we treat it as an error case similar to what would happen if we have issues communicating with the printer driver for the user's selected printer. This is the approach in comment 9's screenshot.

We can also generate a fake printer in JS, which is what we have to do to get the preview to work (like in comment 5), but this doesn't disable the controls because the Print Preview thinks it has a valid printer. We would need to add extra logic to get it to look mostly like an error state while having the preview displayed. We can do that if you strongly prefer that approach, but I think it would be preferable not to add too much additional logic for what should be a pretty unusual edge case - this should only happen for kiosk users where the device owner/administrator hasn't configured any printers.
Makes sense. Then lets go ahead with the approach in comment 9. 
Project Member

Comment 14 by bugdroid1@chromium.org, Nov 28

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1

commit ae42d1168e763a3a302b2bb395d5c3da7b4c13c1
Author: rbpotter <rbpotter@chromium.org>
Date: Wed Nov 28 02:40:52 2018

Print Preview: Show an error when there are no printers

In kiosk app mode with no printers configured the preview spins forever
because in kiosk mode we cannot fall back to Save as PDF. This
currently only occurs on Chrome OS, as other platforms do not have app
kiosk mode. Handle this case gracefully by notifying the user that
there are no printers available.

Also update the change button to the old behavior of disabled during
load, since there should now be no case where the preview and
destinations settings show spinners indefinitely.

See the linked bug comment 9 for screenshot.

Bug:  903680 
Change-Id: I2c3e9a5b41520176cd8fe170886d97e317df05d3
Reviewed-on: https://chromium-review.googlesource.com/c/1344836
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611528}
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/browser/resources/print_preview/data/destination_store.js
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/browser/resources/print_preview/new/app.js
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/browser/resources/print_preview/new/destination_settings.html
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/browser/resources/print_preview/new/destination_settings.js
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/browser/resources/print_preview/new/preview_area.js
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/test/data/webui/print_preview/destination_select_test.js
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/test/data/webui/print_preview/destination_settings_test.js
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/test/data/webui/print_preview/native_layer_stub.js
[modify] https://crrev.com/ae42d1168e763a3a302b2bb395d5c3da7b4c13c1/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js

Status: Fixed (was: Started)

Sign in to add a comment