move qr code inside the certificate

This commit is contained in:
root
2026-05-26 03:09:48 -04:00
parent cc0b83c1b9
commit 22d6f960ea
@@ -464,11 +464,17 @@ class CertificateController extends BaseController
$pdf->Image($imgDir . 'background.png', 280, 176, 291, 340);
$pdf->Image($imgDir . 'signature.png', 140, 410, 90, 80);
// ── QR code — bottom-right corner: 1.5 cm from bottom, 2.5 cm from right
// ── "Presented to:"
$pdf->SetFont('times', 'B', 24);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY(0, 151);
$pdf->Cell($W, 24, 'Presented to:', 0, 0, 'C');
// ── QR code — left-aligned with "Presented to:", vertically centred on that line
$qrSize = 42; // pt
if (!empty($verifyUrl)) {
$qrX = $W - 70.87 - $qrSize; // 2.5 cm from right edge
$qrY = $H - 42.52 - $qrSize; // 1.5 cm from bottom edge
$qrX = 120; // ~1 cm from left edge
$qrY = 171 + (24 - $qrSize) / 2; // vertically centred on "Presented to:" row
$style = [
'border' => false,
'padding' => 0,
@@ -478,12 +484,6 @@ class CertificateController extends BaseController
$pdf->write2DBarcode($verifyUrl, 'QRCODE,L', $qrX, $qrY, $qrSize, $qrSize, $style, 'N');
}
// ── "Presented to:"
$pdf->SetFont('times', 'B', 24);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY(0, 151);
$pdf->Cell($W, 24, 'Presented to:', 0, 0, 'C');
// ── Student name — center based on actual string width
$pdf->SetFont($edwardianFont, '', 38);
$nameX = ($W - $pdf->GetStringWidth($name)) / 2;