Commit 1142f505 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Printing (Windows only): Fix issue with custom paper sizes

Setting the paper size by ID does not work for custom user sizes, which
have values >= DMPAPER_USER = 256. Set the width and length directly in
these cases.

Bug: None
Change-Id: I7c23c656920ac6287c680e2408554c5da716871d
Reviewed-on: https://chromium-review.googlesource.com/690698Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505421}
parent a67ec70f
......@@ -204,7 +204,9 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
int width = requested_media.size_microns.width() / kFromUm;
int height = requested_media.size_microns.height() / kFromUm;
unsigned id = 0;
if (base::StringToUint(requested_media.vendor_id, &id) && id) {
// If the paper size is a custom user size, setting by ID may not work.
if (base::StringToUint(requested_media.vendor_id, &id) && id &&
id < DMPAPER_USER) {
dev_mode->dmFields |= DM_PAPERSIZE;
dev_mode->dmPaperSize = static_cast<short>(id);
} else if (width > 0 && height > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment