Welcome Guest, Not a member yet? Register   Sign In
CI4 Dynamic DOMPDF view ,
#4

Try something simple like:
Code:
$data['testMessage'] = 'Testing domPDF with PHP code';
$dompdf = new \Dompdf\Dompdf();
$dompdf->loadHtml(view('Modules\Views\Admin\pdf_view', $data ));
$dompdf->setPaper('A4', 'landscape');
$dompdf->set_option('defaultMediaType', 'all');
$dompdf->set_option('isFontSubsettingEnabled', true);
$dompdf->set_option('isPhpEnabled', true);
$dompdf->render();
$dompdf->stream();

And a simple view:

Code:
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Codeigniter 4 PDF Example - positronx.io</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
</head>

<body>
<div class="container mt-5">

    <h2>Generate PDF in Codeigniter from View</h2>

    <?php echo $testMessage;?>

</div>
</body>

</html>

Does your view load correctly on screen?
Reply


Messages In This Thread
CI4 Dynamic DOMPDF view , - by devBee - 07-13-2022, 03:26 AM
RE: CI4 Dynamic DOMPDF view , - by JustJohnQ - 07-13-2022, 09:12 AM
RE: CI4 Dynamic DOMPDF view , - by devBee - 07-13-2022, 09:43 PM
RE: CI4 Dynamic DOMPDF view , - by JustJohnQ - 07-15-2022, 02:08 AM
RE: CI4 Dynamic DOMPDF view , - by devBee - 07-15-2022, 05:36 AM
RE: CI4 Dynamic DOMPDF view , - by trunky - 11-14-2023, 10:55 AM
RE: CI4 Dynamic DOMPDF view , - by kenjis - 11-14-2023, 05:10 PM
RE: CI4 Dynamic DOMPDF view , - by datamweb - 11-29-2023, 04:42 AM
RE: CI4 Dynamic DOMPDF view , - by kenjis - 11-29-2023, 02:51 PM
RE: CI4 Dynamic DOMPDF view , - by datamweb - 11-29-2023, 03:06 PM
RE: CI4 Dynamic DOMPDF view , - by kenjis - 11-29-2023, 03:20 PM
RE: CI4 Dynamic DOMPDF view , - by trunky - 12-21-2023, 11:25 AM
RE: CI4 Dynamic DOMPDF view , - by kenjis - 12-21-2023, 01:57 PM
RE: CI4 Dynamic DOMPDF view , - by trunky - 12-27-2023, 06:00 AM
RE: CI4 Dynamic DOMPDF view , - by kenjis - 12-27-2023, 05:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB