Custom print style should be added

(Abel Van) #1

I know that I can custom my site in the Customize panel, but the problem is how the set a print style for my site?

One way is do something like:

@media print{
 /*add your print style here*/

Format for hard copy or PDF printing
(Kane York) #2

The currently recommended workaround for printing is to load the topic page with javascript disabled and print that.

However, you can put any SCSS in the Customize panel, including @media queries. There’s nothing stopping you from doing that.

(Jeff Atwood) #3

I want to meet these people that are printing webpages on the Internet.

(Sam Saffron) #4

(Abel Van) #5

The problem is that the @median print method is not work, why?

(Abel Van) #6

It do seems quite wired to print a topic, but when I encounter something that need a really careful consideration,  such as problems in math, we really can’t even give a hint not to say an answer in a short time. Thus, in these case, I believe no one would like to staring at the screen. But if you have better idea, let me know.

(Abel Van) #7

Maybe that’s why you were not care about my topic.

(Abel Van) #8

another problem in the disable js method is that, the mathjax will not work too.

(Kris) #9

the problem with

@media print{
 /*add your print style here*/
is that you're still only printing what's currently in view, if you have a thread with 100 posts most of them won't print. So it's a bit more complicated than just a print stylesheet. 

(Sam Saffron) #10

All we are saying is that getting print right is not high on the core dev teams priority list.

If you can commission someone to work on a feature that gives us kick ass printing ability with tight code that does not bloat core, we would be more than happy to review and accept the PR.

Format for hard copy or PDF printing
(Cameron Martin) #11

IE and Firefox support print-related events which could be used to load the whole thread, but it is hardly a cross-browser solution, and the performance implications could be massive on a large thread.

See Javascript Event Handler for Print - Stack Overflow and WindowEventHandlers.onbeforeprint - Web APIs | MDN

(Cameron Martin) #12

Also see MediaQueryList - Web APIs | MDN

By combining these two approaches, you can actually get pretty decent browser support.

You’d also probably have to use synchronous ajax calls for loading the rest of the page, since otherwise the print view would render before the page is updated.

Automatically bumping old topics on a category
(Sam Saffron) #13

Print style now exists in core, for most of your printing needs

(Sam Saffron) #14