I tried to export my datatables into the PDF using dompdf, however, not all the tables fit into the page so the content is cut, here's what it looks like:
Here's my controller and blade.pdf
Controller
public function exportpdf($id)
{
$submission = Submission::all()->where('id', $id);
$sub = $submission->load('programStudies');
$realizations = Realization::all()->where('submission_id', $id);
$pdf = PDF::loadview('realisasi.pdf',['submission'=>$sub, 'realizations'=>$realizations]);
return $pdf->stream();
}
blade.pdf
<!DOCTYPE html>
<html>
<head>
<title>{{strtotime('now')}}</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<style type="text/css">
table tr td,
table tr th{
font-size: 9pt;
}
</style>
<center>
@foreach($submission as $pengajuan)
<h5>Laporan Realisasi Prodi {{$pengajuan->programStudies->implode('nama_prodi', ', ')}}</h4>
<br>
<br>
</center>
<p>Pengajuan {{ $pengajuan->tahun_akademik . ' Semester ' . $pengajuan->semester }}</p>
<p>{{ $pengajuan->siswa . ' Siswa' }}</p>
@php $fmt = new NumberFormatter('id_ID', NumberFormatter::CURRENCY) @endphp
<p>{{ $fmt->format($pengajuan->pagu) }}</p>
@endforeach
<table id="detail-pengajuan-table" class="table table-striped w-100">
<thead>
<tr class="text-bold">
<th rowspan="2">Nama Barang</th>
<th rowspan="2">Gambar</th>
<th colspan="2" class="text-center">Jumlah Barang</th>
<th colspan="2" class="text-center">Harga Total</th>
<th rowspan="2">Terealisasi (%)</th>
<th rowspan="2">Keterangan</th>
</tr>
<tr class="text-bold">
<th>Pengajuan</th>
<th>Realisasi</th>
<th>Pengajuan</th>
<th>Realisasi</th>
</tr>
</thead>
<tbody>
@php $fmt = new NumberFormatter('id_ID', NumberFormatter::CURRENCY) @endphp
@foreach($realizations as $realisasi)
<tr>
<td>{{ $realisasi->nama_barang }}</td>
<td><img src="{{ 'storage'. str_replace('public', '', $realisasi->image_path) }}" alt="Gambar Barang"
width="250"></td>
<td>{{ empty($realisasi->submissionDetail) ? 0 : $realisasi->submissionDetail->negotiation->jumlah }}</td>
<td>{{ $realisasi->jumlah }}</td>
<td>{{ empty($realisasi->submissionDetail) ? $fmt->format(0) : $fmt->format($realisasi->submissionDetail->negotiation->harga_total) }}</td>
<td>{{ $fmt->format($realisasi->harga_total) }}</td>
<td>{{ empty($realisasi->submissionDetail) ? '100%' : round((($realisasi->harga_total / $realisasi->submissionDetail->negotiation->harga_total) * 100), 2) . '%' }}</td>
<td>{{ $realisasi->keterangan }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>
I want to make the pdf to show all the content in the page, how to do and fix it?