summaryrefslogtreecommitdiffstats
path: root/printing/print_settings_initializer_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'printing/print_settings_initializer_win.cc')
-rw-r--r--printing/print_settings_initializer_win.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/printing/print_settings_initializer_win.cc b/printing/print_settings_initializer_win.cc
index 0f6a930..0ec96d0 100644
--- a/printing/print_settings_initializer_win.cc
+++ b/printing/print_settings_initializer_win.cc
@@ -49,6 +49,14 @@ void PrintSettingsInitializerWin::InitPrintSettings(
GetDeviceCaps(hdc, HORZRES),
GetDeviceCaps(hdc, VERTRES));
+ // Sanity check the printable_area: we've seen crashes caused by a printable
+ // area rect of 0, 0, 0, 0, so it seems some drivers don't set it.
+ if (printable_area_device_units.IsEmpty() ||
+ !gfx::Rect(physical_size_device_units).Contains(
+ printable_area_device_units)) {
+ printable_area_device_units = gfx::Rect(physical_size_device_units);
+ }
+
print_settings->SetPrinterPrintableArea(physical_size_device_units,
printable_area_device_units,
dpi);