Loop for printing per page

0

I have a loop:

<?php for($i=0; $i<=20; $i++){ ?>
<div id="">
   <?php echo $i; ?>
</div>
<?php } ?>

I need each of these DIVs to appear separately at the time of printing, that is, one item per page, regardless of the height of the div, I would like it to be just one div per page, how could I do that? I'm going to print / print in PDF.

    
asked by anonymous 08.08.2017 / 20:34

1 answer

3

At the location where you want to break the page, put this command:

<div style="page-break-after: always"></div>

It will break to the next page.

    
08.08.2017 / 20:41