dimanche 1 mars 2015

A4 Size page create dynamically in HTM and CSS, if data is more than one page than display more pages with same design. Thanks

iI have this code in HTML and CSS for print the page in A4 size, but I want to create page dynamically eg. if data is more than one page than auto create a new page with same design. kindly help me to set this code for that purpose.



<style>
body {
margin: 0;
padding: 0;
background-color: #FAFAFA;
font: 12pt "Tahoma";
}
* {
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.page {
width: 21cm;
min-height: 29.7cm;
padding: 2cm;
margin: 1cm auto;
border: 1px #CCC solid;
border-radius: 5px;
background: white;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
.subpage {
padding: 1cm;
border: 1px #666 solid;
height: 256mm;
outline: 2cm #CCC solid;
}

@page {
size: A4;
margin: 0;
}
@media print {
html, body {
width: 210mm;
height: 297mm;
}
/* ... the rest of the rules ... */
}
@media print {
.page {
margin: 0;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
}
</style>
</head>
</body>
<div class="book">
<div class="page">
<div class="subpage" align="center">Page 1/2</div>
</div>
<div class="page">
<div class="subpage">Page 2/2</div>
</div>
<div class="page">
<div class="subpage">Page 2/2</div>
</div>
</div>
</body>
</html>

Aucun commentaire:

Enregistrer un commentaire