M
M
Margo19642016-02-03 13:33:55
css
Margo1964, 2016-02-03 13:33:55

How to fit the entire HTML area when printing?

In a pop-up window, the generated html document is sent for printing. But it is printed in chunks on 2 pages. How to fit in the whole area? So that everything fits on one sheet, regardless of the content?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mr Crabbz, 2016-02-03
@Punkie

Actually try:

@media print {
body {max-height: 100vh; max-width: 100vw; overflow: hidden;}
}

And font-size - pick up purely at random.

M
Maxim Timofeev, 2016-02-03
@webinar

And how do you imagine it? In a window of 200,000 characters fit on one page? If the content is completely unknown, then nothing. If there is at least an approximate understanding of how much text can be there, then you can change the font size, for example, through vh. Something like:

@media print {
body {font-size:2vh; line-height:2vh;}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question