Postingan lainnya
export laporan pdf livewire dengan img (logo)
saya sudah berhasil membuat export laporan pdf dengan livewire.
saat saya menambahkan img (logo) di hasil pdf tidak tampil ..image.png
public function exportPdf()
{
return response()->streamDownload(function () {
$transactions = Transaction::search($this->search)->with('order')
->whereBetween('date', [date('Y-m-d',strtotime($this->startDate)), date('Y-m-d',strtotime($this->lastDate))])
->orderBy($this->sortField, $this->sortAsc ? 'asc' : 'desc')
->paginate($this->perPage!=0 ? $this->perPage : Transaction::count());
$store = Store::first();
$pdf = App::make('dompdf.wrapper');
$pdf->loadView('livewire.finance.pdf',[
'transactions'=> $transactions,
'startDate' => $this->startDate,
'lastDate' => $this->lastDate,
'store' => $store,
])->setOptions(['defaultFont' => 'sans-serif']);
$pdf->stream();
}, 'report.pdf');
}
di blade
<tr>
<th rowspan="2" class="text_tengah"
style="border-top: 1px solid rgb(255, 255, 255);border-bottom: 1px solid rgb(255, 255, 255);border-right: 1px solid rgb(255, 255, 255);border-left: 1px solid rgb(255, 255, 255);" width="10%">
<img src="{{ asset('storage/logos/'.$store->logo) }}" alt="" srcset="" width="40" height="40">
</th>
<th class="text_tengah"
style="border-top: 1px solid rgb(255, 255, 255);border-bottom: 1px solid rgb(255, 255, 255);border-right: 1px solid rgb(255, 255, 255);border-left: 1px solid rgb(255, 255, 255); color: white;">
<h3>{{ $store->name }}</h3>
</th>
</tr>
sudah saya coba di blade lain img bisa tampil
namun saat di export pdf
img tidak bisa tampil
mohon bantuan para suhu...
1 Jawaban:
<div>Problem itu setau saya adalah bawaan dari dompdfnya. Solusinya kita harus set Choot path-nya terlebih dahulu. Silahkan cek forum ini <a href="https://sekolahkoding.com/forum/dompdf-tidak-tampil-gambar-dicodeigniter-3-1607046587">https://sekolahkoding.com/forum/dompdf-tidak-tampil-gambar-dicodeigniter-3-1607046587</a> harusnya solusinya sama.<br><br>Silahkan cek referensi berikut juga : <a href="https://stackoverflow.com/questions/45690599/laravel-dompdf-error-image-not-found-or-type-unknown">https://stackoverflow.com/questions/45690599/laravel-dompdf-error-image-not-found-or-type-unknown</a></div>