0

I am trying to generate a dynamic invoice based on my database. The information works just fine. And the pdf is generated perfectly the way I want it. HOWEVER.

The images are not loading, "image not found or type unknown" is what I get.

All other posts regarding this question have not been a help. And they all don't use localhost and are in the public domains.

I am developing on my local machine with XAMPP. I have gone through practically every forum out there and tried every solution. These include: setting isRemoteEnabled to true, enabling the GD extension, converting the image to base64 and etc.

I have been stuck on this one problem for ever now and I would really appreciate some help on this.

My DOMPDF version is 2.0.3

This is my code:

<?php
// Include autoloader 
    require_once 'dompdf/autoload.inc.php'; 
    require ("config.php"); 


use Dompdf\Dompdf; 
use Dompdf\Options;

$options = new Options();
$options->setIsRemoteEnabled(true);
$dompdf = new Dompdf($options);
 

// Load HTML content 
$html = '
<!DOCTYPE html>
<html>
<body>';

$html .= '<header>';

$html .= '<img src="{{ url("C:\xampp\htdocs\magna\logo1.jpeg") }}" style="position: absolute; top: -7px; left: 1px; width: 50px;" />';
$html .= '<div style="position: relative; top: 15px; text-align: center;">
                <h2>Tax Invoice</h2>
            </div>';

$html .= '</header>';

//Output the PDF
$dompdf->loadHtml($html);
$dompdf->render();
$dompdf->stream("invoice.pdf", array("Attachment" => false));

 
// Setup the paper size and orientation 
$dompdf->setPaper('A4', 'landscape'); 
?>

I tried every solution available. My expected outcome is to see the image load up in the PDF document.

This is what it shows me currently: Image not found or type incorrect

0 Answers0