Comments (16)
If anyone lands here, perhaps this will help:
@media print {
html, body {
height: 100vh;
margin: 0 !important;
padding: 0 !important;
overflow: hidden;
}
}
from react-to-print.
The solution from @srj-github almost solved my problem (thank you btw). I had to make a little change.
Instead of
height: 100vh;
I had to write
height: auto;
In my case, I had a list which orginally had several rows but I wanted to print only the ones that were checked. If you write 100vh, the print won't take more than one page (it seems that it always prints one page), even when sometimes you actually need two or more pages to show all the rows. But if you write the value auto for the prop height, then it will automatically calculate the correct quantity of pages you need.
from react-to-print.
For whoever needs dynamic content that can be more than 1 page, and @JavierVescio's solution didn’t work for him. I managed to remove the extra page with this-
@media print {
html, body {
height: initial !important;
overflow: initial !important;
}
}
from react-to-print.
Hi @LucasBSC can you please create a new issue with more details if you are experiencing a problem? Thank you
from react-to-print.
If anyone lands here, perhaps this will help:
@media print { html, body { height: 100vh; margin: 0 !important; padding: 0 !important; overflow: hidden; } }
Thanks, @srj-github, It has worked for me.
from react-to-print.
height: 100vh; margin: 0 !important; padding: 0 !important; overflow: hidden;
It works for me!!
Thanks, friend.
from react-to-print.
Thanks, this works @srj-github
from react-to-print.
height: 100vh; margin: 0 !important; padding: 0 !important; overflow: hidden;
Not working
from react-to-print.
Hi @shyam2794 sorry for the delay. Try the new beta version which is going to rely on an iframe to solve the cross origin issues some people are experiencing.
npm install [email protected]
and let me know the feedback if this solves issues
from react-to-print.
There has been a rewrite pivoting away from popup windows.
npm install [email protected] --save
from react-to-print.
I am facing the same issue with firefox, and neither of those versions fix the issue. Also tried using pageStyle to set the overflow property with no success. Works great on chrome
from react-to-print.
Hello, is this problem already solved somehow? Having same issue here
from react-to-print.
I am using the latest version and no working for me; is there and other proposed solution please
from react-to-print.
@zainpros if you are having problems please create a new issue and describe your problem, as well as share the code you are using please, thank you.
from react-to-print.
ya it is working only for one page but let suppose it page can be 100 page or some time it can be 1 page
but when it is only one page still it is showing two page so on basis of page count we would be inject css ?
from react-to-print.
height: 100vh; margin: 0 !important; padding: 0 !important; overflow: hidden;It works for me!! Thanks, friend.
This works for me. It handles one page and multiple pages correctly. @srj-github 's solution will cut it to a dead one page.
from react-to-print.
Related Issues (20)
- Page break wide content HOT 3
- Superscripts <sup/> and subscripts <sub/> HOT 1
- react-to-print custom print html content dev vs prod discrepancy HOT 4
- [BUG] [TEMPORARY FIX] - Print container on Chrome + MUI is hiding `Header and Footers` option as default behavior HOT 5
- The FOOTER to only display at the LAST PAGE HOT 3
- codesandbox examples are not loading HOT 2
- onAfterPrint is called before print iframe appears HOT 1
- On mobile devices are not truncated accordingly ref HOT 1
- Add Border to every Page HOT 4
- 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 3
- 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 4
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.