How do I put the number of each page with domPDF? I use it with laravel.
Example: Page 1-4, Page 2-4, Page 3-4, and Page 4-4;
My function for fetching bank data:
public function print($id) {
$budget = Budget::find($id);
$budgetItems = BudgetItem::where('budget_id', '=', $budget->id)->get();
$pdf = PDF::loadView('reports.budgetprint', ['budget' => $budget, 'budgetItems' => $budgetItems]);
return $pdf->stream('budgetprint.pdf');
}
And my rendering:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Report Quote</title>
</head>
<body>
<div class="text-center">
<img src="<?php echo public_path() . '/images/logoreport.png'; ?>" alt="Logo" width="300px">
</div>
<p>
<span><strong>Client:</strong> {{ $budget->client_name }};</span>
<span style="float: right;"><strong>Date:</strong> {{ date_format(new DateTime($budget->created_at), 'm-d-Y') }}</span>
</p>
<p>{{ $budget->client_address }}</p>
<p>
<span><strong>Cell:</strong> {{ $budget->client_phone }} / {{ $budget->client_cell_phone }}</span>
<span style="float: right;"><strong>E-mail:</strong> {{ $budget->client_email }}</span>
</p>
<hr>
<table class="table table-bordered table-condensed" style="margin-bottom: 100px;">
<thead>
<tr>
<th style="width: 50px;">Room</th>
<th>Items</th>
<th style="width: 40px; text-align: center;">Qty</th>
<th style="width: 80px; text-align: center;">Price</th>
<th style="width: 80px; text-align: center;">Subtotal</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">-</td>
<td>{{ $budgetItem->name }}</td>
<td style="text-align: center;">{{ $budgetItem->amount }}</td>
<td style="text-align: center;">{{ number_format($budgetItem->price, 2, '.', ',') }}</td>
<td style="text-align: center;">{{ number_format($budgetItem->subtotal, 2, '.', ',') }}</td>
</tr>
</tbody>
</table>
</body>
</html>
Thanks for the help.