Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function generatePDF()
- {
- $siswa = $this->AsramaModel->getData();
- $setting = $this->AdminModel->getAll();
- $data = [
- 'title' => 'Biodata Siswa',
- 'setting' => $this->AdminModel->getAll(),
- 'row' => $this->TahunAjaranModel->getAktif(),
- 'jalur' => $this->JalurModel->getAktif(),
- 'siswa' => $this->AsramaModel->getData(),
- 'prestasi' => $this->DetailPrestasiModel->getAll_detail_prestasi(),
- 'foto_siswa' => $this->getImageDataFromDatabase(),
- ];
- // Load Dompdf options
- $options = new Options();
- $options->set('isPhpEnabled', true); // Aktifkan PHP
- $options->set('isHtml5ParserEnabled', true); // Aktifkan parser HTML5
- $options->set('isRemoteEnabled', true); // Aktifkan akses URL eksternal
- // Instantiate Dompdf class with options
- $dompdf = new Dompdf($options);
- // Load HTML content from view
- $viewContent = view('siswa/asrama/coba', $data);
- // Load HTML into Dompdf
- $dompdf->loadHtml($viewContent);
- // Set paper size and orientation
- $dompdf->setPaper('A4', 'portrait');
- // Render PDF
- $dompdf->render();
- // Output PDF to browser
- $dompdf->stream("example.pdf", array("Attachment" => false));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement