Skip to content

Commit

Permalink
address feedback from @jkleinsc
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Aug 9, 2019
1 parent afefc76 commit 024f022
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions docs/api/web-contents.md
Expand Up @@ -1264,9 +1264,8 @@ Returns [`PrinterInfo[]`](structures/printer-info.md).
* `dpi` Object (optional)
* `horizontal` Number (optional) - The horizontal dpi.
* `vertical` Number (optional) - The vertical dpi.
* `headerFooterInfo` Object (optional)
* `header` String - String to be printed as page header.
* `footer` String - String to be printed as page footer.
* `header` String - String to be printed as page header.
* `footer` String - String to be printed as page footer.
* `callback` Function (optional)
* `success` Boolean - Indicates success of the print call.
* `failureReason` String - Called back if the print fails; can be `cancelled` or `failed`.
Expand Down
13 changes: 6 additions & 7 deletions shell/browser/api/atom_api_web_contents.cc
Expand Up @@ -1674,14 +1674,13 @@ void WebContents::Print(mate::Arguments* args) {
settings.SetInteger(printing::kSettingCopies, copies);

// Strings to be printed as headers and footers if requested by the user.
mate::Dictionary header_footer;
if (options.Get("headerFooterInfo", &header_footer)) {
settings.SetBoolean(printing::kSettingHeaderFooterEnabled, true);
std::string header;
options.Get("header", &header);
std::string footer;
options.Get("footer", &footer);

std::string header;
header_footer.Get("header", &header);
std::string footer;
header_footer.Get("footer", &footer);
if (!(header.empty() && footer.empty())) {
settings.SetBoolean(printing::kSettingHeaderFooterEnabled, true);

settings.SetString(printing::kSettingHeaderFooterTitle, header);
settings.SetString(printing::kSettingHeaderFooterURL, footer);
Expand Down

0 comments on commit 024f022

Please sign in to comment.