Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sudiptobain8's avatar

Laravel Pdf Genarate With Dompdf Problem

Image Not Showing I got An error Logo Image not found or type unknown My Code

$contxt = stream_context_create([
           'ssl' => [
               'verify_peer' => FALSE,
               'verify_peer_name' => FALSE,
               'allow_self_signed' => TRUE
           ]
       ]);
       
       $pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true]);
       $pdf->getDomPDF()->setHttpContext($contxt);
       $pdf->loadView('UserSide.Template.invoiceford', compact('CompanyDetails', 'InvoiceData'))->setOptions(['defaultFont' => 'sans-serif', 'dpi' => 96])

and blade code

<img src="{{ url('uploads/CompanyImages/') . '/' . $CompanyDetails->Company_Logo }}" alt="Logo">
0 likes
1 reply
azbx's avatar

This could be a result of two things:

  1. Your image uploading code is failing.
  2. You need to run the imagmak command.

2.1?

  1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
  2. If you are using apache2, you are advised to add ppa:ondrej/apache2
  3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline or ppa:ondrej/nginx then sudo apt-get install imagemagick php{version number with no brackets}-imagick
1 like

Please or to participate in this conversation.