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

Fix viewport not being set correctly #553

Merged
merged 1 commit into from
Nov 15, 2022
Merged

Fix viewport not being set correctly #553

merged 1 commit into from
Nov 15, 2022

Conversation

MatthewHerbst
Copy link
Owner

@MatthewHerbst MatthewHerbst commented Nov 15, 2022

Fixes #327

Without this the browser sets the iframe to its default size of width 300px x length 150px, which could cause the browser to print the components differently if there are styles present that change the content based on viewport size.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe

Without this the browser sets the `iframe` to its default size
of width 300px x length 150px

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
@nosinformatica
Copy link

nosinformatica commented Dec 14, 2023

@MatthewHerbst I still have this problem how can i fix?

@MatthewHerbst
Copy link
Owner Author

Hi @nosinformatica could you provide more information please? What browser/version and what version of react-to-print? An example such as in Codesandbox that shows the issue would be ideal, thanks!

@nosinformatica
Copy link

Hi @nosinformatica could you provide more information please? What browser/version and what version of react-to-print? An example such as in Codesandbox that shows the issue would be ideal, thanks!

Hi, i made the sandbox: https://codesandbox.io/p/sandbox/wrong-viewport-react-to-print-sandbox-zs4fww?file=%2Fsrc%2FApp.js

@surajnarayanan1
Copy link

Hi, I'm facing a similar issue with the view port. Has this been resolved?

@MatthewHerbst
Copy link
Owner Author

@surajnarayanan1 any issues you are facing here are almost certainly related to your styles, and is unlikely to be a bug in react-to-print: we don't change the viewport or your styles. If you are using a component library many will change the viewport when printing. If you want to post more about your situation maybe we can try and help there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Printing uses mobile viewport instead of desktop
3 participants