diff --git a/app/Services/QrStickerService.php b/app/Services/QrStickerService.php index 36721a3..4be5455 100644 --- a/app/Services/QrStickerService.php +++ b/app/Services/QrStickerService.php @@ -85,16 +85,19 @@ class QrStickerService */ private function generatePdf(Order $order, string $qrUrl): string { - // Generate QR code as base64-encoded PNG (DomPDF handles this better than SVG) + // Generate QR code as SVG, then convert to data URI $options = new QROptions([ - 'outputType' => QRCode::OUTPUT_IMAGE_PNG, + 'outputType' => QRCode::OUTPUT_MARKUP_SVG, 'eccLevel' => QRCode::ECC_H, - 'scale' => 8, - 'imageBase64' => true, + 'scale' => 4, + 'imageBase64' => false, ]); $qrCode = new QRCode($options); - $qrBase64 = $qrCode->render($qrUrl); + $qrSvg = $qrCode->render($qrUrl); + + // Convert SVG to data URI for embedding in HTML + $qrDataUri = 'data:image/svg+xml;base64,' . base64_encode($qrSvg); // Determine order type $orderType = $order->type === 'standard' ? 'STOCK ORDER' : 'CUSTOM ORDER'; @@ -254,7 +257,7 @@ class QrStickerService
- QR Code + QR Code