I don’t know how long this will last (due to future coding changes)…
… totally not recommended …
… and you follow these instructions at your own risk - ie. there is “no support” …
… and your browser may crash doing this …
… but for anybody desperate enough to need to do it.
There is a global variable that influences “cloaking” - which is what hides / removes content when it scrolls out of view to save memory / allow Discourse behave as well as it does on low-powered devices whilst scrolling.
That variable is
However it needs to be set before the main Discourse code loads.
You can use Chrome Dev Tools to do this:
- Go to the topic page you want to print in the browser
- Scroll to the top
- Press F12 (this opens Chrome Dev Tools)
- Press F5 (refreshes the page)
- Select the “Sources” tab
- Find the source code to the page you are currently on in the left hand nav, double click it to open the actual source code.
- Scroll down until you find the first
<script> HTML tag in the source
- Add a break point in by clicking the line number of the first line of script.
- You should see a blue arrow, like the one on line 43 pictured above (it might not be line 43).
- Press Esc, this toggles the display of the “Console”, if you don’t see it - press it again and it should appear.
- In the Console type
window.inTestEnv = true and press Enter
- Press F12 (this closes Chrome Dev Tools)
- Slowly and repeatedly press Page Dn until you reach the bottom of the topic.
- Press Ctrl+P (this opens the print dialog).
- Select “Save as PDF” Destination and press “Save”.
- Select the location to save the file, press “Save”.
Note that you may have to repeat the sequence 15 though 17 quickly / repeatedly until the file actually saves - as the print dialog closes / crashes when there is an issue. I found doing 15 though 17 faster and changing the destination away from a printer to PDF got me there in the end.
I test printed the “1000 replies” topic on “try” and it “works for me” to prove it works for long topics (outputs a 206 page A4 document).
Please don’t try this on here on “meta” only on your “own” personal instances.
By the way my option is that time should be put into Service Worker / offline support - not printing.