How to print header and footer on all pages?
Here is a simple example about what I mean:
let table = document.getElementById('table');
for (let i = 1; i <= 100; i++) {
  table.insertAdjacentHTML('beforeend', `<tr><td>${i}</td><td>title ${i}</td><td>${i*3}$</td></tr>`);
}@media print {
  .invoice-footer {
    height: 2rem;
    position: fixed;
    bottom: 0;
  }
  .no-print {
    display: none
  }
}
table {
  margin-bottom: 2rem;
}<button onclick="window.print()" class="no-print">Print</button>
<div class="invoice">
  <img src="https://picsum.photos/200/150?random=1" width="200" class="invoice-logo">
  <hr>
  <table border="1" style="width:100%">
    <thead>
      <tr>
        <th>#</th>
        <th>Title</th>
        <th>Price</th>
      </tr>
    </thead>
    <tbody id="table"></tbody>
  </table>
  <div class="invoice-footer">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  </div>
</div>