New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Math.ceil to pageSize.height and pageSize.width to printToPDF() o… #9396

merged 1 commit into from Jun 26, 2017


None yet
2 participants

drulm commented May 6, 2017

…ptions to prevent error on display.

In reference to #9361, Math.ceil()'ed the height and width parameters. Tested on Ubuntu 16.04 as working.

Proposed solution:

in /lib/browser/api/web-contents.js

// Translate the options of printToPDF.
WebContents.prototype.printToPDF = function (options, callback) {
      printingSetting.mediaSize = {
        name: 'CUSTOM',
        custom_display_name: 'Custom',
        // Add Math.ceil() to page height and width.
        height_microns: Math.ceil(pageSize.height),
        width_microns: Math.ceil(pageSize.width)

zcbenz approved these changes Jun 26, 2017


@zcbenz zcbenz merged commit 5fbcb6e into electron:master Jun 26, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment