Laravel / Snappy不显示PDF图像

时间:2019-06-12 13:41:20

标签: laravel-5

我想生成发票的pdf格式。 pdf已生成,但无法显示图像 我将laravel / snappy用于窗口

这是我的查看文件

<div>
<img src="{{ asset('image/logo.png') }}" class="pl-3" width="15%" />
<a href="{{ route('pdfview',['download'=>'pdf']) }}">Download PDF</a>
</div>

这是我的控制器

if($request->has('download')) {
$pdf = PDF::loadView('pdfview')- 
>save(storage_path('invoices/aazsaa.pdf'));
return $pdf->download('userlist.pdf');
}

图像显示在视图中,但是当我下载图像时未呈现

1 个答案:

答案 0 :(得分:0)

是的,我已经解决了我的问题 我使用base64编码器显示图像

这是我的查看文件

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAABkCAMAAAD5Y6hXAAAArlBMVEX////rUYmIHVHwf6j2rsj60eDfw9GoWX/Hlq7sXZH+8/f38POQLF3Ppbn73Of3udDuaJnn0tz86O/v4ejyi7DvdKG4d5egSnTzl7iYO2j0osCwaIv4xdjXtMXAhqLq2OH84+y/haGdRG+FFEuSMF+zb5Dy5uzewM/e3uDHlKz0nb3NoLb0Z5nwcZ/27vLsWY7DxMb0xdemX4Pl5ebCv8LR0dTBwsTzw9b2s8ylUnsmpw2bAAAO7ElEQVR4nO1diXajuBLFNtgsxjaL8e4sz0kmnemkO+/1zOT/f+yh0loSi8hiJ9O+Z860QQulS1GqKgniOGecccYZZ5xxxhlnfAFEt3f+zcv14XBYra4Xo+Jh+BidWqZ/DbJ4c+hrWBW721PL9a9Asl/p3FIsHrJTy/blcXuvkDsuTcNKUeRFfGrxvjjuXhiT1zf7eDdMLi6S5C7eP3OOi7OFeAMeKI2rq7sMTWWPF7sN5ffl4lSyfX3sgcGDX2Vjo+SGqvWZ31fiCvi74eSGYZpepmEoyu+ugd+zfXgVfJjNHuhB6q0Hs+DpKZjNc/dnSjl+BAUenV3gV2A3JoZhB78v3e89FUE+TaEAzMfVKcX8osjIkz8GdkN31jPw3QWCCb/j4WlF/YKIwPD65OdkYJ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IyMn/HQTbGTB6d3qJvoKXFsN+ZXt9MrB4DnucM75zJVkbtR6d3BGTt6TZXuh+zLdNP3Mpu9EZ7W3qjov3xsYQ3p0nQafD9Jz93CnpHGVXJhUOpa11IGXWl13Fs6Y0tHh87/PPUe/o7unmOvECmq45O74ZuzR7yBz7ZjFrnoA+k138vekk67ulnOayd92dPZKvvT+Q5CHpt8IH0ZmP6FL0VkDEN/i4fhnug9+kSTv/u9DrR8F2+PQgrOAq9bHXvE9FbDnSo2IlkKAZO6S2PeVCUQUVcvzwpKyB6UQG70FBplqkFCapmnYyBL2YEYBwmQO+f4D7s/>

我更改了标签中图片的src。我只是将图像的base64字符串而不是路径放在了上面,这是可行的