Closed chanakaDe closed 1 month ago
Found a solution on my own after playing few mins. I have to say code gpt helped me a lot to debug this PDF generation process. This code is generated by code gpt. VSCode codegpt plugin.
<!DOCTYPE html>
<html>
<head>
<title>Invoice</title>
</head>
<body>
<h1>Invoice</h1>
<!-- Base64 Encoded Image -->
@php
$imagePath = public_path('images/my-logo.png');
$imageData = base64_encode(file_get_contents($imagePath));
$imageSrc = 'data:image/png;base64,' . $imageData;
@endphp
<img src="{{ $imageSrc }}" alt="my logo">
</body>
</html>
I'm trying to load this image in a PDF.
<img src="{{ asset('images/justrent-logo.png') }}" alt="justrent logo">
Controller code:
But it seems images are not rendered in the PDF. How to fix this?PLease advice.