diff options
author | sverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 17:59:55 +0000 |
---|---|---|
committer | sverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 17:59:55 +0000 |
commit | c86d472e35440254cf860f40c40aaaf45992bfdc (patch) | |
tree | 19e6ccba4b4f3e2faf7aa8baa8abe1699ee999c7 /chrome/browser/printing | |
parent | a15cdd8a261db61ed279f2eaddf1dc72d0a282e0 (diff) | |
download | chromium_src-c86d472e35440254cf860f40c40aaaf45992bfdc.zip chromium_src-c86d472e35440254cf860f40c40aaaf45992bfdc.tar.gz chromium_src-c86d472e35440254cf860f40c40aaaf45992bfdc.tar.bz2 |
Scale the margins according to the DPI of the printer. The margins were fixed at 500 units which caused the margins to be huge for low DPI (low quality) printing output.
BUG=http://crbug.com/14502
TEST=Print with different DPI settings and notice how the margins stay the same physical width.
Review URL: http://codereview.chromium.org/145008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r-- | chrome/browser/printing/print_settings.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/chrome/browser/printing/print_settings.cc b/chrome/browser/printing/print_settings.cc index e25a937..d7eeeb0 100644 --- a/chrome/browser/printing/print_settings.cc +++ b/chrome/browser/printing/print_settings.cc @@ -75,20 +75,22 @@ void PrintSettings::SetPrinterPrintableArea( gfx::Size const& physical_size_pixels, gfx::Rect const& printable_area_pixels) { + int margin_printer_units = ConvertUnit(500, kHundrethsMMPerInch, dpi_); + // Start by setting the user configuration // Hard-code text_height = 0.5cm = ~1/5 of inch page_setup_pixels_.Init(physical_size_pixels, printable_area_pixels, - ConvertUnit(500, kHundrethsMMPerInch, dpi_)); + margin_printer_units); // Now apply user configured settings. PageMargins margins; - margins.header = 500; - margins.footer = 500; - margins.left = 500; - margins.top = 500; - margins.right = 500; - margins.bottom = 500; + margins.header = margin_printer_units; + margins.footer = margin_printer_units; + margins.left = margin_printer_units; + margins.top = margin_printer_units; + margins.right = margin_printer_units; + margins.bottom = margin_printer_units; page_setup_pixels_.SetRequestedMargins(margins); } |