I got a problem with snappy package. I'm trying to generate a pdf with a external image, but I got an error when do this:
$pdf = PDF::loadView('admin-customer.tag.pdf-view', $product)
->setOption('page-width', '100')
->setOption('page-height', '70.5')
->setOption('margin-top', 2)
->setOption('margin-bottom', 2)
->setOption('margin-left', 2)
->setOption('margin-right', 2);
return $pdf->download($product->name . '.pdf');
My view:
<div class="qrcode">
<img src="//api.qrserver.com/v1/create-qr-code/?data=http://trackagro.com.br" alt="">
<h6 class="msg">
CONSULTE PELO SEU LEITOR DE QR-CODE OU EM NOSSO SITE TRACKAGRO.COM.BR
</h6>
</div>
The error:
Page 1 of 1 Done Exit with code 1 due to network error: ContentNotFoundError " stdout: "" command: D:\Projects\empresas\trackagro\trackagro-sistema\vendor\wemersonjanuario\wkhtmltopdf-windows\bin\64bit\wkhtmltopdf --lowquality --margin-bottom "2" --margin-left "2" --margin-right "2" --margin-top "2" --page-height "70.5" --page-width "100" "C:\Users\PopApps\AppData\Local\Temp\knp_snappy5dcaeaf096db73.71503659.html" "C:\Users\PopApps\AppData\Local\Temp\knp_snappy5dcaeaf09905f2.88209190.pdf".
I've been researching and managed to solve using another library to generate qrcode, which generates the image in SVG: https://www.simplesoftware.io/simple-qrcode/
And my code:
$pdf = PDF::loadView('admin-customer.tag.pdf-view', $product)
->setOption('page-width', '100')
->setOption('page-height', '70.5')
->setOption('margin-top', 2)
->setOption('margin-bottom', 2)
->setOption('margin-left', 2)
->setOption('margin-right', 2)
->setOption('images', true);
return $pdf->download($product->name . '.pdf');
And my view:
<img src="data:image/png;base64, {{ base64_encode(QrCode::format('png')->size(100)->generate('http://trackagro.com.br')) }}" />
Thanks a lot