How to scale down page content to fit window.print()

169
February 15, 2022, at 00:50 AM

I have a problem with window.print function. I have a page that should fit A4 landscape page, but it doesn't. It looks like A4 page is not wide enough, so it pushes some of the content to the next page (I have 5 cards in a row, one of them is pushed to the second row). Is there any way to scale down the content without changing the width etc. of every object?

Answer 1

Of course!

You can use the print media query like this:

@media print {
    print-area *{ /* can be whatever CSS selector you need */
        transform: scale(x)
    }
}

where x is the size you want to scale down.

Rent Charter Buses Company
READ ALSO
Chrome vertically aligns any image opened in a new tab

Chrome vertically aligns any image opened in a new tab

Whenever you open an image in chrome, it displays it in a dark background with vertically and horizontally centeredI just wondered which CSS properties Chrome uses to achieve that

124
How can I forcefully change the padding inside a mat-expansion-panel-body?

How can I forcefully change the padding inside a mat-expansion-panel-body?

so I just created an expansion panel and it's working fine (it's very hardcoded though)I need to, however, eliminate a padding entirely from the subpanel part and I can't find a proper way to do it

126
html/css/js - marquee, scroll one element then pause, then scroll again

html/css/js - marquee, scroll one element then pause, then scroll again

I am trying to create an overlay page for my twitch channelI play Rocket League and the tracker network site provides overlays that show your rank

100
My sticky positioned element isn't acting like it should

My sticky positioned element isn't acting like it should

Usually, I don't have any issues with the sticky position propertyHowever, I can't figure out why my div isn't behaving so

115