最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dompdf - Laravel app does not generates .jpg or .png photo as background image - Stack Overflow

programmeradmin4浏览0评论

I am developing a Laravel application on Windows OS. Among other things, the application needs to generate reports, including a background image within them. I am using the barryvdh/laravel-dompdf PDF printer. The code that triggers the generation of the PDF document is:

$pdf = PDF::setOptions(['defaultFont' => 'sans-serif', 'isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('admin.pdf.report', compact('report', 'title', 'reportcontent')); $pdf->render(); return $pdf->download('Report'.'.pdf');

Within the layout for the specified view, the selector is defined as follows:

#background{ background-image: url('{{ asset('logo\logo.png') }}'); background-position: center; background-repeat: no-repeat; background-size: 500px 500px; }

The specified selector is called in the view within the tag as follows: `<div id="background" > ...

`

When running the application locally on my Windows OS, the background image appears in the generated PDF document. However, when I deploy it to a Linux server, the image is not displayed. I have tried using an absolute path, but I am still facing the same issue. Has anyone encountered a similar problem? Could the issue be related to the file path or the server settings?

An important thing to note is that the application deployed on the Linux server displays images when using absolute paths from other servers (such as portals), but it does not display images from its own server.

发布评论

评论列表(0)

  1. 暂无评论