give this a shot. i replaced :: with :
<img src="data:image/png;base64,{{ DNS1D::getBarcodePNG($data->code_product,'C39') }}" height="60" width="180" /><br />
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm having problem displaying barcode using milon/barcode with domPDF
If i try to output it in html with the following code it works properly.:
laravel controller file //where dataproduct is array of product.id, product.name and etc
return view('produk.barcode',compact('dataproduct','no'));
html:
<img src="data::image/png;base64,{{ DNS1D::getBarcodePNG($data->code_product,'C39') }}" height="60" width="180" /><br />
when I try to output it with dompdf with the following code, the barcode doesn't show up properly. it gives "image not found or type unknown" error message
laravel controller file //where dataproduct is array of product.id, product.name and etc
$pdf = PDF::setOptions(['isHtml5ParserEnabled'=>true,'isRemoteEnabled'=>true])->loadView('product.barcode',compact('dataproduct','no'));
$pdf->setPaper('a4', 'potrait');
return $pdf->stream();
html:
<img src="data::image/png;base64,{{ DNS1D::getBarcodePNG($data->code_product,'C39') }}" height="60" width="180" /><br />
it seems that dompdf can't display the png image i generated on fly. Can anyone help me with this problem?
thanks
give this a shot. i replaced :: with :
<img src="data:image/png;base64,{{ DNS1D::getBarcodePNG($data->code_product,'C39') }}" height="60" width="180" /><br />
Please or to participate in this conversation.