Skip to content Skip to sidebar Skip to footer

How To Print Page Number In Print Preview In Html Page Contains Table

here i have some of the tables , i need to print this html page, with page number,the table content may differ dynamically, i unable to print the page number dynamically ,I have t

Solution 1:

If you want you can use counter

body{
  counter-reset: page;
}

.page-counter:after {
    counter-increment: page;
    content: "Page "counter(page);
}
<divclass="page">
  fake content
  <divclass="page-counter"></div></div><divclass="page">
  fake content
  <divclass="page-counter"></div></div>

If you want to use " page 1 / 10" you can create a div with spans inside of it equal to the number pages you have

body{
  counter-reset: page;
}

#total-counter{
    counter-reset: totalPages;
}
#total-counterspan{
  counter-increment: totalPages;
}

.page-counter:after {
    counter-increment: page;
    content: "Page "counter(page) " / "counter(totalPages);
}
<divid="total-counter"><span></span><span></span></div><divclass="page">
  fake content
  <divclass="page-counter"></div></div><divclass="page">
  fake content
  <divclass="page-counter"></div></div>

Post a Comment for "How To Print Page Number In Print Preview In Html Page Contains Table"