feat: allow specifying pageSize for print (#22014)

This commit is contained in:
Shelley Vohr 2020-02-05 04:25:02 +00:00 committed by GitHub
parent 385388dd6b
commit 928175bdfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 2 deletions

View file

@ -1897,6 +1897,12 @@ void WebContents::Print(gin_helper::Arguments* args) {
options.Get("duplexMode", &duplex_mode);
settings.SetIntKey(printing::kSettingDuplexMode, duplex_mode);
// We've already done necessary parameter sanitization at the
// JS level, so we can simply pass this through.
base::Value media_size(base::Value::Type::DICTIONARY);
if (options.Get("mediaSize", &media_size))
settings.SetKey(printing::kSettingMediaSize, std::move(media_size));
// Set custom dots per inch (dpi)
gin_helper::Dictionary dpi_settings;
int dpi = 72;