-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improve print output #680
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
Improve print output #680
Conversation
Really need a checklist or something for making CSS changes. |
c50d166
to
6fbed87
Compare
Browsers this old are already hilariously broken, so we don't need these fallbacks.
I tried running this on the user guide and got some pretty funny results. Using But then when I tried saving the example book as PDF (via the print button) from the |
@Michael-F-Bryan I can't reproduce that issue with either Chrome or Firefox and "Microsoft Print to PDF", can you give more specifics? |
Chrome won't execute this if it's not marked as js
Ah, OK. If I open the html in Chrome, I see the same issue. Doesn't happen with |
The issue doesn't happen in Firefox, and Chrome doesn't print any messages to the console. The print CSS doesn't reference any external files. I'm at a loss why this only happens on Chrome+Print+File and not any other situation... |
Unconditionally enabled the print CSS and the page renders fine, but the problem persists 😠. |
If I close the print dialog then Control+P again, it works fine. I think the issue is that in Chrome+File the page resources load quickly so DomContentLoaded fires before the page is completely finished rendering, or something. |
Alright, adding a 100ms delay seems to solve the issue. |
2033734
to
514615e
Compare
In certain situations Chrome willl fire window.onLoad before it's done rendering. Add a 100ms delay to work around this.
514615e
to
ea88aec
Compare
@mattico I just checked out your latest changes and that seems to have fixed the issue. Chrome+File and Chrome+Serve is now rendering the print page correctly 🎉 |
* Update print styles for new sidebar behavior * Hide copy icons in print output * Wait for mathjax rendering to complete before printing * Remove old wrapping css Browsers this old are already hilariously broken, so we don't need these fallbacks. * Change mathjax script type Chrome won't execute this if it's not marked as js * Ensure page has rendered before printing In certain situations Chrome willl fire window.onLoad before it's done rendering. Add a 100ms delay to work around this.
Since #648, the content doesn't use
left
/padding-left
to make room for the sidebar, instead usingtransform
/margin-left
. The print CSS wasn't updated for this change, so if the sidebar was visible it would push content to the right when printing.