Skip to content

Commit

Permalink
fix: webContents.printToPDF option plumbing (#35975)
Browse files Browse the repository at this point in the history
fix: contents.printToPDF option plumbing
  • Loading branch information
codebytere committed Oct 11, 2022
1 parent 0759f33 commit ee7cf5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions lib/browser/api/web-contents.ts
Expand Up @@ -174,13 +174,13 @@ WebContents.prototype.printToPDF = async function (options) {
headerTemplate: '',
footerTemplate: '',
printBackground: false,
scale: 1,
scale: 1.0,
paperWidth: 8.5,
paperHeight: 11,
marginTop: 0,
marginBottom: 0,
marginLeft: 0,
marginRight: 0,
paperHeight: 11.0,
marginTop: 0.0,
marginBottom: 0.0,
marginLeft: 0.0,
marginRight: 0.0,
pageRanges: '',
preferCSSPageSize: false
};
Expand Down Expand Up @@ -210,7 +210,7 @@ WebContents.prototype.printToPDF = async function (options) {
if (typeof options.scale !== 'number') {
return Promise.reject(new Error('scale must be a Number'));
}
printSettings.scaleFactor = options.scale;
printSettings.scale = options.scale;
}

const { pageSize } = options;
Expand Down
12 changes: 6 additions & 6 deletions shell/browser/api/electron_api_web_contents.cc
Expand Up @@ -2857,12 +2857,12 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
settings.GetDict().FindBool("displayHeaderFooter");
auto print_background = settings.GetDict().FindBool("shouldPrintBackgrounds");
auto scale = settings.GetDict().FindDouble("scale");
auto paper_width = settings.GetDict().FindInt("paperWidth");
auto paper_height = settings.GetDict().FindInt("paperHeight");
auto margin_top = settings.GetDict().FindIntByDottedPath("margins.top");
auto margin_bottom = settings.GetDict().FindIntByDottedPath("margins.bottom");
auto margin_left = settings.GetDict().FindIntByDottedPath("margins.left");
auto margin_right = settings.GetDict().FindIntByDottedPath("margins.right");
auto paper_width = settings.GetDict().FindDouble("paperWidth");
auto paper_height = settings.GetDict().FindDouble("paperHeight");
auto margin_top = settings.GetDict().FindDouble("marginTop");
auto margin_bottom = settings.GetDict().FindDouble("marginBottom");
auto margin_left = settings.GetDict().FindDouble("marginLeft");
auto margin_right = settings.GetDict().FindDouble("marginRight");

This comment has been minimized.

Copy link
@Bogarde21
auto page_ranges = *settings.GetDict().FindString("pageRanges");
auto header_template = *settings.GetDict().FindString("headerTemplate");
auto footer_template = *settings.GetDict().FindString("footerTemplate");
Expand Down

1 comment on commit ee7cf5a

@Bogarde21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.