我在PDF文件中显示QR码时遇到问题。当我尝试显示不带PDF的QR码时,它可以工作。 QR代码是由https://github.com/SimpleSoftwareIO/simple-qrcode生成到https://github.com/barryvdh/laravel-dompdf/tree/0.8.5生成的pdf文件中的
StudentController.php:
public function view_downlads($id){
$pdf = PDF::loadView('Student.markscardpdf');
return $pdf->stream();
}
Student / markscardpdf.blade.php:
{{ QrCode::size(200)->generate('hello') }}
您可以通过转换base64格式在image标签中使用库输出。
示例:
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(200)->generate('http://google.com')) !!} ">