Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Krishma's avatar

Dompdf

How to add text i.e to be continued in between for each loop

0 likes
12 replies
Krishma's avatar

I have a table in which i have 102 rows so on single page along with header i cant print 102 rows so half of the table is printed on next page so in first page at the bottom i want to write to be continued.... Below is my code

@foreach ($dataz as $order)
        <tr>
            <td>{{$order->cust_order_no}}</td>
            <td>{{$order->fg_item}}</td>
            <td>{{$order->net_wt}}</td>
            <td>{{$order->qty}}</td>
            <td>{{$order->rate}}</td>
            <td>{{$order->amount}}</td>
        </tr>
        @endforeach
vandan's avatar

@krishma

$count = 0;
@foreach ($dataz as $order)
        @if($count == 102)
        @break; 
            // Your code
        $count++;
        //To Be Continue
@endforeach 

try this

Krishma's avatar

but it wont be complusary that there will be fix number of rows

Krishma's avatar

In my code in between for each loop i want to write (TO BE CONTINUED...)for next page is it possible

Krishma's avatar

I want to add some text inside foreach loop(or any loop) how can i do that

Krishma's avatar

In dompdf pdf how will i write some text at end of the page???

Krishma's avatar
Order.No Part Name Net Wt Qty in Pcs Rate/USD/100 Amount DDP-OHRINGEN @foreach ($dataz as $order) {{$order->cust_order_no}} {{$order->fg_item}} {{$order->net_wt}} {{$order->qty}} {{$order->rate}} {{$order->amount}} @endforeach Total {{$datax->net_wt}} {{$datax->total_qty}} {{$datax->total_amount}}

Output i m getting is 102rows and entire 102 rows are getting printed on 3 pages in pdf file so in between foreach loop i need to add some text like the the table is continued on next page so is that possible to break loop somewhere so that i can add sme text at the end of the page ??

Krishma's avatar

Code: @foreach ($dataz as $order) {{$order->cust_order_no}} {{$order->fg_item}} {{$order->net_wt}} {{$order->qty}} {{$order->rate}} {{$order->amount}} @endforeach

Krishma's avatar

how to give page number out of total pages in dompdf for example: 1 of 3 how to code the above example in dompdf

Krishma's avatar

How to set fix number of rows in dompdf pdf file for particular page using foreach loop

Please or to participate in this conversation.