|
Количество
|
Стоимость
|
||
|
|
|||
Css Pdf Notes < Best >
a[href]::after content: " (" attr(href) ")"; /* show URLs */
1. The @page Rule Controls page boxes, margins, size, and breaks.
/* Avoid break after heading */ h2 page-break-after: avoid;
.no-break break-inside: avoid;
</style> </head> <body> <h1>Chapter 1</h1> <p>PDF-ready content…</p> </body> </html> | Tool | Best for | |--------------|------------------------------| | PrinceXML | Professional, complex books | | WeasyPrint | Open source, good CSS support| | Paged.js | Browser polyfill for @page | | wkhtmltopdf | Legacy HTML → PDF (WebKit) | | Chrome headless | Simple print-emulation | These notes give you a solid foundation to style HTML for reliable, print-ready PDF output. Keep a copy handy when working on reports, e‑books, or invoices.
.page-header position: running(page-header); font-size: 10pt; color: gray;
Use @media print to isolate PDF styles.
@media print body font-size: 11pt; /* pt recommended for print */ line-height: 1.4; .no-print display: none;
Using running() and element() .
h2 page-break-after: avoid;
<div class="page-header">My PDF Report | Chapter 1</div> body counter-reset: chapter section;
@page @top-left content: element(page-header);