'NEW/2026/0010', 'client_name' => 'Pranab', 'phone' => '9876543210', 'address' => 'Champasari, Siliguri', 'invoice_date' => '26-02-2026' ]; $items = [ ['description'=>'22kt Gold Ring','price'=>45000], ['description'=>'Gold Chain','price'=>65000], ]; /* ------------------------- BACKGROUND IMAGE (BASE64) --------------------------*/ $imagePath = __DIR__ . '/invoice.jpg'; // apni JPG file ka naam $imageData = base64_encode(file_get_contents($imagePath)); $imageSrc = 'data:image/jpeg;base64,' . $imageData; $total = 0; foreach($items as $item){ $total += $item['price']; } /* ------------------------- HTML START --------------------------*/ ob_start(); ?>
Invoice No:
Name:
Phone:
Address:
Date:
Total : ₹
set('isHtml5ParserEnabled', true); $options->set('isPhpEnabled', true); $options->set('isRemoteEnabled', true); $dompdf = new Dompdf($options); $dompdf->loadHtml($html); $dompdf->setPaper('A4','portrait'); $dompdf->render(); $dompdf->stream("invoice.pdf", ["Attachment"=>1]);