vendredi 2 août 2019

Laravel. Print dialog don't appear while clicking a print button

i got some problem with the dompdf, i want to make a button that can print out of my data, but seems not working when i trying to click the print button, It must be pop-up in the browser when i clicked the button, but nothing happens.

Here's the code of functioning tu print of my Controller

public function cetak_pdf()
{
    $das = Da::all();

    $pdf = PDF::loadview('das_pdf',$das);
    return $pdf->download('data-anak.pdf');
}

and here's the das_pdf that called above

<!DOCTYPE html>
<html>
<head>
    <title>Data Anak</title>

</head>
<body>
    <style type="text/css">
        table tr td,
        table tr th{
            font-size: 9pt;
        }
    </style>
    <center>
        <h5>Laporan Data Anak</h4>

    </center>

    <table class="table table-hover table-bordered" id="sampleTable">
        <thead>
            <tr>
                                    <th>Nama</th>
                                    <th>Gender</th>
                                    <th>Tgl.Lahir</th>
                                    <th>Status</th>
                                    <th>Sekolah</th>
                                    <th>Aksi</th>

                                </tr>
                            </thead>
                            <tbody>  
                            @foreach ($das as $da)  
                            <tr>

                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
            </tr>
            @endforeach
        </tbody>
    </table>

</body>
</html>

and here's the button my index_blade.php

            <a href="/das/cetak_pdf" class="btn btn-primary" target="_blank">
                <i class="fa fa-download">
                    Download

Any help will be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire