Open MariaMironets opened 1 year ago
I think this is a Codesandbox/iframe
specific thing. The URL of the page within Codesandbox is the iframe they are using to sandbox the code, not codesandbox.io
thanks! but definitely not codesandbox specific, it's reproducible in our app as well
Could you show an example please?
window.print
will print the entire page from the root, so it will have the correct url, but the wrong content. react-to-print
prints from within an iframe
, this is how it prints only the content you want printed, not the whole page.
Sure! Here is the repo containing the same example - https://github.com/MariaMironets/react-to-print-example
update: it's also reproducible with your examples locally (with pageStyle set to '').
Ah, I see. This text is set by the browser, not react-to-print
(which is why we hide it by default). I don't think we have a way to control this; react-to-print
must use an iframe
to print. I see it working fine in Chrome. I will look through the Firefox open issues and see if this has been reported yet, thanks!
Thanks a lot!
Hey. @MatthewHerbst , is it possible to use CSS to set the text in the header to white ?
So, it's there but it's like it isn't there because it blends with the white background color and is hidden.
Since the text is set by the browser and so cannot be removed completely but maybe can be hidden
is it possible to use CSS to set the text in the header to white ?
It's an interesting idea, I'm not sure. It would depend on if that text is injected while the page is still in its HTML state or if it's injected later on in the printing. My assumption is the latter, since if they injected it while the page was still HTML they would risk screwing up styles for the page.
I am encountering this same issue in Firefox and Safari, but not in Chrome and Edge.
Hi! I noticed an issue with Firefox, both on macOS and windows - instead of URL in the header
about:srcdoc
text is presented. This issue is reproducible in the sandbox and is not reproducible with window.print().Print with react-to-print:
Print with window.print():
Here is an example: https://codesandbox.io/s/async-morning-6hchhs?file=/src/App.js