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.