Message: Required parameter $img follows optional parameter $w

selamat malam, Barang kali ada yang tahu cara mengatasi ini saya mau export ke pdf menggunakan dompdf tapi kok muncul eror seperti ini yah

A PHP Error was encountered
Severity: 8192
Message: Required parameter $img follows optional parameter $w
Filename: lib/class.pdf.php
Line Number: 4157
Backtrace:
File: C:\xampp\htdocs\app_rental_mobil\application\third_party\dompdf\include\cpdf_adapter.cls.php
Line: 58
Function: _error_handler
File: C:\xampp\htdocs\app_rental_mobil\application\third_party\dompdf\include\cpdf_adapter.cls.php
Line: 58
Function: require_once
File: C:\xampp\htdocs\app_rental_mobil\application\third_party\dompdf\dompdf_config.inc.php
Line: 370
Function: require_once
File: C:\xampp\htdocs\app_rental_mobil\application\third_party\dompdf\include\canvas_factory.cls.php
Line: 80
Function: DOMPDF_autoload
File: C:\xampp\htdocs\app_rental_mobil\application\third_party\dompdf\include\dompdf.cls.php
Line: 655
Function: get_instance
File: C:\xampp\htdocs\app_rental_mobil\application\controllers\customer\transaksi.php
Line: 79
Function: render
File: C:\xampp\htdocs\app_rental_mobil\index.php
Line: 315
Function: require_once

public function pdf($id)
    {
        $this->load->library('dompdf_gen');
        $data['transaksi'] = $this->db->query("SELECT * FROM transaksi tr, mobil mb, customer cs WHERE tr.id_mobil=mb.id_mobil AND tr.id_customer=cs.id_customer AND tr.id_rental='$id' ORDER BY id_rental DESC")->result();

        $this->load->view('customer/laporan_pdf',$data);

        $paper_size = 'A5';
        $orientation = 'potrait';
        $html = $this->output->get_output();
        $this->dompdf->set_paper($paper_size, $orientation);

        $this->dompdf->load_html($html);
        $this->dompdf->render();
        $this->dompdf->stream("Invoice_Pembayaran.pdf", array('Attachment' =>0));
    }

Fucntion pdf

<html><head>
    <title></title>
    </head><body>
<table class="table table-bordered table-stripped" style="width: 60%">
    <h3 style="text-align: center">INVOICE PEMBAYARAN RENTAL MOBIL KELOMPOK 2</h3>

        <?php foreach($transaksi as $tr): ?>
            <tr style="font-weight: bold; color:green;">
                <td>ID Customer</td>
                <td>:</td>
                <td><?php echo $tr->id_customer ?></td>
            </tr>
            <tr style="font-weight: bold; color:green;">
                <td>ID Rental</td>
                <td>:</td>
                <td><?php echo $tr->id_rental ?></td>
            </tr>
            <tr style="font-weight: bold; color:green;">
                <td>Nama Customer</td>
                <td>:</td>
                <td><?php echo $tr->nama ?></td>
            </tr>
        <tr style="font-weight: bold; color:green;">
            <td>Nama Mobil</td>
            <td>:</td>
            <td><?php echo $tr->merk ?></td>
        </tr>

        <tr style="font-weight: bold; color:green;">
            <td>Tanggal Rental</td>
            <td>:</td>
            <td><?php echo $tr->tanggal_rental ?></td>
        </tr>

        <tr style="font-weight: bold; color:green;">
            <td>Tanggal Kembali</td>
            <td>:</td>
            <td><?php echo $tr->tanggal_kembali ?></td>
        </tr>

        <tr style="font-weight: bold; color:green;">
            <td>Harga Sewa / Hari</td>
            <td>:</td>
            <td>Rp.<?php echo number_format( $tr->harga,0,',','.') ?></td>
        </tr>

        <tr style="font-weight: bold; color:green;">
            <td>Status Pembayaran</td>
            <td>:</td>
            <td><?php if($tr->status_pembayaran == '0') {
                echo "Pembayaran Belum Lunas";
            }else{
                echo "Pembayaran Lunas";
                }
                ?>
                </td>
            </tr>

        <tr style="font-weight: bold; color:green;">
            <?php
                $x = strtotime($tr->tanggal_kembali);
                $y = strtotime($tr->tanggal_rental);
                $jmlhari = abs(($x - $y)/(60*60*24));
            ?>
            <td>Total Hari</td>
            <td>:</td>
            <td><?php echo $jmlhari ?> Hari</td>
        </tr>
            <tr></tr>
            <tr></tr>
            <tr></tr>
        <tr style="font-weight: bold; color:red;">
            <td>TOTAL PEMBAYARAN</td>
            <td>:</td>
            <td>Rp.<?php echo number_format($tr->harga * $jmlhari,0,',','.') ?></td>
        </tr>

        <tr>
                    <td>Rekening Pembayaran</td>
                    <td>:</td>
                    <td>
                        <ul>
                                <li>Bank BCA : 25371368147348 a/n Rental Mobil kelompok 2
                                <li>Bank BRI : 36542736472647 a/n Rental Mobil kelompok 2</li>
                                <li>Bank MANDIRI : 31233463274678 a/n Rental Mobil kelompok 2</li>
                            </li>
                        </ul>
                    </td>
                </tr>

            <?php endforeach; ?>

        </table>

        </body> </html>


View Laporan_pdf

mohon bantuan nya maklum masih pemula di CI 3

avatar yusufbachtiar_google_6375
@yusufbachtiar_google_6375

4 Kontribusi 0 Poin

Diperbarui 2 tahun yang lalu

Tanggapan

Pakai dompdf versi brapa?

Cara cek nya gmna ya gan ?

1 Jawaban:

<div>Coba function pdf-nya diubah menjadi seperti ini :<br><br></div><pre>public function pdf($id) { $this-&gt;load-&gt;library('dompdf_gen'); $data['transaksi'] = $this-&gt;db-&gt;query("SELECT * FROM transaksi tr, mobil mb, customer cs WHERE tr.id_mobil=mb.id_mobil AND tr.id_customer=cs.id_customer AND tr.id_rental='$id' ORDER BY id_rental DESC")-&gt;result();

    $html = $this-&amp;gt;load-&amp;gt;view(&#039;customer/laporan_pdf&#039;,$data, true);

    $paper_size = &#039;A5&#039;;
    $orientation = &#039;potrait&#039;;

    $this-&amp;gt;dompdf-&amp;gt;set_paper($paper_size, $orientation);

    $this-&amp;gt;dompdf-&amp;gt;load_html($html);
    $this-&amp;gt;dompdf-&amp;gt;render();
    $this-&amp;gt;dompdf-&amp;gt;stream(&quot;Invoice_Pembayaran.pdf&quot;, array(&#039;Attachment&#039; =&amp;gt;0));

}</pre><div><br>Semoga berhasil.</div>

avatar ahanafi
@ahanafi

815 Kontribusi 554 Poin

Dipost 2 tahun yang lalu

Tanggapan

Baik gan akan saya coba terimakasih atas bantuan nya

Izin bertanya abang2, ini gimana ya cara mengatasi nya

A PHP Error was encountered Severity: 8192

Message: Required parameter $currentfont follows optional parameter $isunicode

Filename: include/tcpdf_fonts.php

Line Number: 2019

Backtrace:

File: C:\xampp\htdocs\barang-gudang\application\libraries\tcpdf\tcpdf.php Line: 115 Function: _error_handler

File: C:\xampp\htdocs\barang-gudang\application\libraries\tcpdf\tcpdf.php Line: 115 Function: require_once

File: C:\xampp\htdocs\barang-gudang\application\libraries\Pdf.php Line: 3 Function: require_once

File: C:\xampp\htdocs\barang-gudang\application\controllers\Report.php Line: 10 Function: library

File: C:\xampp\htdocs\barang-gudang\index.php Line: 315 Function: require_once

Login untuk ikut Jawaban