Skip to content
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

[Feature Request]: Re-enable fitToPageEnabled option for print and printToPDF #30674

Closed
3 tasks done
dattn opened this issue Aug 24, 2021 · 2 comments
Closed
3 tasks done

Comments

@dattn
Copy link

dattn commented Aug 24, 2021

Preflight Checklist

Problem Description

Electron scales my html content down, to fit into the paper/page size.
I want it to print the page without any scaling.

After some research, i've found the following pull request, which added a new option "fitToPageEnabled":
#20436

But this has been removed again with the following pull request:
#21906

Is there a reason this has been removed again ? Is there some other way to completely disable scaling for printing and pdf generation?

My current code looks like this:

win.webContents.print({
    printBackground: true,
    margins: {
        marginsType: 'none'
    },
    fitToPageEnabled: false,
    scaleFactor: 100
})

This does scale the page down to fit the page, which i'm trying to avoid.

Proposed Solution

Add a "fitToPageEnabled" option to print and printToPdf

Alternatives Considered

Ignore Printer Paper size setting when an @page css rule is defined ?

Additional Information

Tested with electron 13.2.1 on Ubuntu 20.04

@codebytere codebytere self-assigned this Oct 26, 2021
@Hedwig188
Copy link

I am also interested in this feature. IE has a "shrink to fit" setting, it would be nice to have it in Electron print APIs so the apps developer no longer needs to do our own calculation to make the dynamic html fit to the page.

@codebytere
Copy link
Member

This is unfortunately due to its removal in the relevant codepaths upstream by Chromium. Should they bring it back, so will we - but in the meantime, we will adhere to their options settings.

@codebytere codebytere closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants