Comments (5)
Hello, thanks for writing this up.
I'm unable to access this link, is it correct/do you need to make it public?
This is really interesting though. I was able to replicate the issue locally using the examples. Commenting out these lines resolved the issue. However, while having those lines commented out I toggled the show headers/footers once, and now, even with those lines running, I cannot replicate the issue. Very strange.
This seems more like an upstream bug in Chrome than a bug with MUI or anything else. Safari does not appear to have this issue. Firefox also seems to not have this issue, and instead forces headers and footers on even with the lines above (which also feels like an upstream bug in Firefox).
Will investigate this more, thank you. My guess is that we have limited ability to fix this in a generic way though 😢
from react-to-print.
@MatthewHerbst lol I forgot to make it public. Now, it's edited with new link, everyone can fork and follow those steps.
from react-to-print.
@sensasi-delight thanks for the report. Based on your fix, it's possible MUI added some code that also uses @media print
so you need your specifier to be more specific to override theirs. Just a guess though, I haven't looked at their code
from react-to-print.
@MatthewHerbst Maybe, after you enabling and commenting again, continue to appear the option because the rule was set on this chrome tab, so you need to force refresh the page(F5/cmd+R) to reproduce again.
On my attempt to reproduce on sandbox by the first time, nextjs v14 with App Router was installed instead of v13 with pages router. So I just simulated there, on v14, without MUI theme provider and etc.
It showed options and header as normal, thats why I think about MUI could be part of the problem.
from react-to-print.
I recently encountered a similar issue where the page margins suddenly disappeared when printing, even though I hadn't changed my code for the past four weeks. Strangely, this printing issue just appeared today. I tried to find which PR from MUI caused this, but there were too many to sift through, making it difficult to pinpoint the exact one. I just wanted to share a solution that I implemented, which is different from what the author suggested. I used the pageStyle
property in the ReactToPrint component:
<ReactToPrint
{...props}
- pageStyle="@page { margin: auto; }" // this line is working fine for the past four weeks
+ pageStyle="@media print { margin: auto; }"
/>
I hope this helps someone experiencing the same problem.
from react-to-print.
Related Issues (20)
- Add dynamic colors to print function HOT 1
- How to check that the user click on Save in `onAfterPrint`? HOT 2
- getting Supplied Data is not a valid base64-String jsPDF.convertStringToImageData erorr while directly downloading image HOT 1
- Border top and bottom HOT 1
- Save as PDF hangs in print view HOT 1
- Blank PDF when trying to generate in production. HOT 2
- How should i handle large data to print? HOT 8
- Why does it render different content when in im browsing in mobile HOT 4
- Blank Page while printing after a certain period of time HOT 9
- How to add style using PageStyle prop, without it overriding component’s style HOT 5
- Warning: findDOMNode is deprecated outside StrictMode. HOT 13
- Unhandled error when trying to print not fully loaded canvas elements HOT 5
- HTML doctype declaration is displaying on top of the print dialog window HOT 10
- Print datatables HOT 4
- CSS "break-before" (replacing "page-break-before") not supported HOT 3
- '.brf' file : Change the save directory. HOT 3
- Disable option in browser window to automatically add headers and footers HOT 1
- img tag adds much more to the final PDF size than it should HOT 3
- State changes not effected fist time for print content HOT 11
- Content Overlaps with Footer in Printed Document HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-to-print.