Added pdf logic for coil packing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 29s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 3m28s
Laravel Larastan / larastan (pull_request) Failing after 5m31s

This commit is contained in:
dhanabalan
2026-09-10 17:28:01 +05:30
parent f8c51bfbe2
commit d043230428

View File

@@ -288,6 +288,52 @@ class PalletController extends Controller
// $mpdf->Output('qr-label.pdf', 'I');
}
public function downloadCoilQrPdf($palletNo)
{
$qrCode = new QrCode($palletNo);
$output = new Output\Png;
$qrBinary = $output->output($qrCode, 100);
$qrBase64 = base64_encode($qrBinary);
$htmlBlock = '
<table class="sticker-table">
<tr>
<td class="qr-cell">
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
</td>
<td class="text-cell">
'.htmlspecialchars($palletNo).'
</td>
</tr>
</table>';
return '
<html>
<head>
<style>
body { margin: 0; padding: 0; width: 50mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
.sticker-table { width: 50mm; height: 60mm; border-collapse: collapse; page-break-after: always; }
.qr-cell { width: 50mm; text-align: right; vertical-align: bottom; padding-left: -8mm; padding-top: 0mm; }
.text-cell { text-align: left; vertical-align: middle; font-size: 22pt; padding-left: 1mm; padding-top: 18mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
img.qr { width: 40mm; height: 40mm; display: block; }
</style>
</head>
<body>
'.$htmlBlock.$htmlBlock.'
<script>
window.onload = function () {
window.print();
setTimeout(function () {
window.close();
}, 1000); // Wait 1 second before closing
};
</script>
</body>
</html>';
}
/**
* Store a newly created resource in storage.
*/