0

I have below code snippet. I need to save each row div in a seperate page in pdf or print?

Body has grey background, which should not come in print and each row div should be printed in separate A4 page (css is done for A4 size paper).

Print should show only these rows and nothing else on page (body, menu, footer etc.)

body{
  background-color: #f1f1f1;
}
.main-page {
       width: 21cm;
       min-height: 29.7cm;
       margin: 1cm auto;
       background: white;
       box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
       padding-left: 1.5cm;
       padding-top: 2cm;
       padding-right: .5cm;
     }
     .sub-page {
       height: 237mm;
     }
<div class="row main-page">
  <div class="col-12 sub-page">
    page 1/n
  </div>
 </div>
 <div class="row main-page">
  <div class="col-12 sub-page">
    page 2/n
  </div>
 </div>
 <div class="row main-page">
  <div class="col-12 sub-page">
    page 3/n
  </div>
 </div>
 <div class="row main-page">
  <div class="col-12 sub-page">
    page 4/n
  </div>
 </div>
Pulkit Sharma
  • 264
  • 1
  • 2
  • 18
  • Without user interaction? – Reflective Oct 31 '21 at 09:58
  • 1
    Does this answer your question? [Splitting HTML page so Printer splits it into separate pages](https://stackoverflow.com/questions/14686883/splitting-html-page-so-printer-splits-it-into-separate-pages) – Kareem Kamal Oct 31 '21 at 09:59
  • @KareemKamal Linked question solved half problem. Still I am getting menu and footer in print area. I need to print only these divs and nothing else. – Pulkit Sharma Oct 31 '21 at 10:05

0 Answers0