Skip to content

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

4 participants