Controlling page-break

Hi!

I’m getting no sucess at controlling page-breaks on my documents.
I’m trying to make a 3-copy custom print. But if my sales-invoice document gets enough items, I would like to insert the page break preferably after each copy.

How could I do that? I know little about html and css… but I tried this with no success

3x this code:

> <div class="print-heading" style="page-break-after: avoid !important">
> 	<h2>Presupuesto Cliente<br>
> 		<small>Sis. N. {{ doc.name }} : Bol. Int. {{ doc.boleta_interna_manual_nro}} </small>
> 	</h2>
> </div>
> 
> 
> <div class="row " style="page-break-after: avoid !important">
> 	<div class="col-xs-6 text-right">
> 		<b>{{ _("Date") }}:</b> {{ doc.get_formatted("posting_date") }}<br>
> 	</div>
> 	<div class="col-xs-6 text-right">
> 		<b>{{ _("Customer") }}:</b> {{ doc.customer_name }}
> 	</div>
> </div>
> 
> 
> <table  class="table table-striped table-bordered cart" style="page-break-after: avoid !important">
> 	<thead>
> 		<tr>
> 			<th width="50%">{{ _("Item Name") }}</b></th>
> 			<th width="15%" class="text-right">{{ _("Qty") }}</th>
> 			<th width="15%" class="text-right">{{ _("Rate") }}</th>	
> 			<th width="20%" class="text-right">{{ _("Amount") }}</th>
> 		</tr>
> 	</thead>
> 	<tbody>
> 		{%- for item in doc.items -%}
> 		<tr>
> 			<td class="text-left">{{ item.item_name }}</td>
> 			<td class="text-right text-lowercase" > {{ item.qty }} {{ _(item.uom) }}</td>
> 			<td class="text-right">{{ item.get_formatted("rate") }}</td>
> 			<td class="text-right">{{ item.get_formatted("amount") }}</td>
> 		</tr>
> 		{%- endfor -%}
> 	</tbody>
> </table>
> <div class="row">
> 	<div class="col-xs-6 text-right">
> 	</div>
> 	<div class="col-xs-6 text-right">
> 		<b>{{ _("Grand Total") }}:</b> {{ doc.get_formatted("grand_total") }}
> 	</div>
> </div>

and this was my result:

thanks in advance!

Have you tried at the end?

Sorry @chrismberi, I didn’t get it…

Is it putting style: pagebreak avoid at the last tag <‘div’>?
but shouldn’t it avoid only at other sessions except this?

Thanks for your response! I’m sorry I know so little about this…

This thread will probably help
https://discuss.erpnext.com/t/add-page-break-to-print-format-while-generating-pdf/37962/23