How to automatically add page 2/2 in html print page pdf

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to automatically add page 2/2 in html print page pdf



How to automatically add page 2/2 to in my HTML print page, every-time the page 1 ends the second page will follow. Right now with my code only page 1 working



Here is my CSS




body
background: rgb(204,204,204);
font-family: "Times New Roman"; /* replace this with your font */

page[size="A4"]
background: white;
width: 21cm;
height: 29.7cm;
display: block;
margin: 0 auto;
margin-bottom: 0.5cm;




@media print
body, page[size="A4"]
margin: 0;
box-shadow: 0;




This is my view


<page size="A4" >@foreach($scores as $key => $score)<table><tr><th>Subject</th><th>Teacher</th><th>MTA</th></tr>@foreach($score as $row)<tr><td>&nbsp; $row->subject->subject_name</td><td>&nbsp; $row->subject->user->name</td><td>&nbsp; $row->term1_ma</td></tr>@endforeach </table>@endforeach </page>





maybe its worth to take a look on css page-break properties, e.g. css-tricks.com/almanac/properties/p/page-break
– Tschitsch
Aug 13 at 7:52


page-break





how to break i'm using loop is it possible?
– Grace
Aug 13 at 7:55




1 Answer
1



Try this in your css, you can use content: counter(page);


@page
@bottom-left
content: counter(page) "/" counter(pages);




Refrence:



http://www.w3.org/TR/CSS21/generate.html#counters



http://www.princexml.com/doc/9.0/page-numbers/





This is only applicable to the Prince library and the DocRaptor API service - standard browsers like Chrome don't support CSS Paged Media (the @page thing).
– jamespaden
Aug 14 at 15:02






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS