fix: honor pageRanges when printing (#25064)

This commit is contained in:
Shelley Vohr 2020-08-27 20:21:29 -07:00 committed by GitHub
parent 8f727b3569
commit a4b6fce907
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 146 additions and 15 deletions

View file

@ -2069,8 +2069,9 @@ void WebContents::Print(gin::Arguments* args) {
int from, to;
if (range.Get("from", &from) && range.Get("to", &to)) {
base::Value range(base::Value::Type::DICTIONARY);
range.SetIntKey(printing::kSettingPageRangeFrom, from);
range.SetIntKey(printing::kSettingPageRangeTo, to);
// Chromium uses 1-based page ranges, so increment each by 1.
range.SetIntKey(printing::kSettingPageRangeFrom, from + 1);
range.SetIntKey(printing::kSettingPageRangeTo, to + 1);
page_range_list.Append(std::move(range));
} else {
continue;