Postingan lainnya
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
1 Jawaban:
<div>Coba function pdf-nya diubah menjadi seperti ini :<br><br></div><pre>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();
$html = $this-&gt;load-&gt;view('customer/laporan_pdf',$data, true);
$paper_size = 'A5';
$orientation = 'potrait';
$this-&gt;dompdf-&gt;set_paper($paper_size, $orientation);
$this-&gt;dompdf-&gt;load_html($html);
$this-&gt;dompdf-&gt;render();
$this-&gt;dompdf-&gt;stream("Invoice_Pembayaran.pdf", array('Attachment' =&gt;0));
}</pre><div><br>Semoga berhasil.</div>
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