How to print a page generated in PHP, so that when printing there are no headers and footers? As well as the question of the size of the block (page), for printing on a single A4 sheet of format. Those. What should be the block size?
1 answer
PHP has nothing to do with it, IMHO. The only thing that can help is to put a whitespace in the title so that it is not displayed. In general, these are browser settings. About the block did not understand. Standard - 2k characters on A4 paper. This is very approximate and very conditional. Most often, the page on A4 sheet is narrower than on the screen. Why dont know. The last recommendation is to use CSS Media:
@media print { /* Тут стандартные свойства CSS для отображения на печати. */ }
Accordingly, a minimum of images, a maximum of contrast and a maximum of rubber.
- > I didn’t understand about the block. Well, I mean, let's say we can make one <div> of fixed sizes and fill it up with content. That's the question where it came from, how it should be, in terms of size. It’s just that in the internet I’ve gotten such information that through css the dimensions must be set either in inches or in centimeters, and in pixels it is impossible. And about the headers, so it is clear that they can be turned off before printing, but in the browser settings. And I would like to somehow script or, say, pass on an empty footer to print - DemoS
- > either in inches or centimeters, but not in pixels. What kind of site? It is very interesting that the authors will say about the construction, such as: h1 {line-height: 1em; margin: 10px 10% 0 10%; padding: 2px; } You cannot control footers. Let's just say that you can always make them print. By default, the address and page number are printed. As for the page-break-before blocks: auto / always / avoid / left / right / inherit; Maybe it will help? - knes
- About inches or centimeters, that's where he took habrahabr.ru/blogs/personal/18580 Okay, thanks, I'll try! - DemoS
|