在Laravel中以PDF文件显示QR码 [英] Displaying QR Code in PDF file, in Laravel
本文介绍了在Laravel中以PDF文件显示QR码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在PDF文件中显示QR码时遇到问题.当我尝试显示不带PDF的QR码时,它可以工作. QR码由 https://github.com/SimpleSoftwareIO/simple-qrcode 生成到> https://github.com/barryvdh/laravel- dompdf/tree/0.8.5
I'm facing a problem with displaying a QR code in a PDF file. When I try to display the QR code without PDF it works. The QR code is generated by https://github.com/SimpleSoftwareIO/simple-qrcode on to a pdf file generated by https://github.com/barryvdh/laravel-dompdf/tree/0.8.5
StudentController.php:
StudentController.php:
public function view_downlads($id){
$pdf = PDF::loadView('Student.markscardpdf');
return $pdf->stream();
}
学生/markscardpdf.blade.php:
Student/markscardpdf.blade.php:
{{ QrCode::size(200)->generate('hello') }}
推荐答案
您可以通过转换base64格式在image标签中使用库输出.
You can use library output within image tag by converting base64 format.
示例:
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(200)->generate('http://google.com')) !!} ">
这篇关于在Laravel中以PDF文件显示QR码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文