diff --git a/app/Http/Controllers/ConclusionController.php b/app/Http/Controllers/ConclusionController.php index 5a7187e..923cef2 100644 --- a/app/Http/Controllers/ConclusionController.php +++ b/app/Http/Controllers/ConclusionController.php @@ -90,14 +90,24 @@ class ConclusionController extends Controller $pdf = new Fpdi(); $pageCount = $pdf->setSourceFile($tmpPath); + $qrSize = 30; // mm for ($i = 1; $i <= $pageCount; $i++) { - $tpl = $pdf->importPage($i); + $tpl = $pdf->importPage($i); $size2 = $pdf->getTemplateSize($tpl); $pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]); $pdf->useTemplate($tpl); - // Add QR to top-right corner - $pdf->Image($qrPath, $size2['width'] - 45, 15, 30, 30); + + if ($i === 1) { + // First page: top-right, inside the frame + $qrX = $size2['width'] - $qrSize - 18; + $qrY = 18; + } else { + // Other pages: bottom-right, pushed to very bottom + $qrX = $size2['width'] - $qrSize - 8; + $qrY = $size2['height'] - $qrSize - 2; + } + $pdf->Image($qrPath, $qrX, $qrY, $qrSize, $qrSize); } // Append certificates from the database @@ -105,23 +115,20 @@ class ConclusionController extends Controller foreach ($certificates as $certificate) { $certPath = storage_path('app/' . $certificate->path); if (file_exists($certPath)) { - // Support both PDF and Image certificates $extCert = strtolower(pathinfo($certPath, PATHINFO_EXTENSION)); if ($extCert === 'pdf') { $certPageCount = $pdf->setSourceFile($certPath); for ($j = 1; $j <= $certPageCount; $j++) { - $tplCert = $pdf->importPage($j); - $sizeCert = $pdf->getTemplateSize($tplCert); + $tplCert = $pdf->importPage($j); + $sizeCert = $pdf->getTemplateSize($tplCert); $pdf->AddPage($sizeCert['orientation'], [$sizeCert['width'], $sizeCert['height']]); $pdf->useTemplate($tplCert); - // Add watermark to certificate page too - $pdf->Image($qrPath, $sizeCert['width'] - 45, 15, 30, 30); + $pdf->Image($qrPath, $sizeCert['width'] - $qrSize - 8, $sizeCert['height'] - $qrSize - 2, $qrSize, $qrSize); // bottom-right } } elseif (in_array($extCert, ['jpg', 'jpeg', 'png'])) { $pdf->AddPage('P', 'A4'); $pdf->Image($certPath, 0, 0, 210, 297); - // Add watermark - $pdf->Image($qrPath, 210 - 45, 15, 30, 30); + $pdf->Image($qrPath, 210 - $qrSize - 8, 297 - $qrSize - 2, $qrSize, $qrSize); // bottom-right, inside frame } } } diff --git a/storage/app/public/attachments/auto_7890/dede1d4d-0f00-4057-877b-5edc1fea22a1.pdf b/storage/app/public/attachments/auto_7890/dede1d4d-0f00-4057-877b-5edc1fea22a1.pdf new file mode 100644 index 0000000..07e896e Binary files /dev/null and b/storage/app/public/attachments/auto_7890/dede1d4d-0f00-4057-877b-5edc1fea22a1.pdf differ diff --git a/storage/app/public/attachments/auto_7891/ec83b184-8a19-4671-98ad-99e884540785.pdf b/storage/app/public/attachments/auto_7891/ec83b184-8a19-4671-98ad-99e884540785.pdf new file mode 100644 index 0000000..944ebc2 Binary files /dev/null and b/storage/app/public/attachments/auto_7891/ec83b184-8a19-4671-98ad-99e884540785.pdf differ diff --git a/storage/app/public/attachments/auto_7891/qr.png b/storage/app/public/attachments/auto_7891/qr.png new file mode 100644 index 0000000..40225b5 Binary files /dev/null and b/storage/app/public/attachments/auto_7891/qr.png differ diff --git a/storage/app/public/attachments/auto_7892/c7e6b9bc-c02e-4ceb-be6a-16c35ed6fd12.pdf b/storage/app/public/attachments/auto_7892/c7e6b9bc-c02e-4ceb-be6a-16c35ed6fd12.pdf new file mode 100644 index 0000000..67d3e2e Binary files /dev/null and b/storage/app/public/attachments/auto_7892/c7e6b9bc-c02e-4ceb-be6a-16c35ed6fd12.pdf differ diff --git a/storage/app/public/attachments/auto_7892/qr.png b/storage/app/public/attachments/auto_7892/qr.png new file mode 100644 index 0000000..282e5a6 Binary files /dev/null and b/storage/app/public/attachments/auto_7892/qr.png differ diff --git a/storage/app/public/attachments/auto_7893/010d4d35-c453-41be-b009-0331528d1873.pdf b/storage/app/public/attachments/auto_7893/010d4d35-c453-41be-b009-0331528d1873.pdf new file mode 100644 index 0000000..ff75d84 Binary files /dev/null and b/storage/app/public/attachments/auto_7893/010d4d35-c453-41be-b009-0331528d1873.pdf differ diff --git a/storage/app/public/attachments/auto_7893/qr.png b/storage/app/public/attachments/auto_7893/qr.png new file mode 100644 index 0000000..61bdd27 Binary files /dev/null and b/storage/app/public/attachments/auto_7893/qr.png differ diff --git a/storage/app/public/attachments/auto_7894/0d837284-c3e4-4e87-8d12-0e78cd50b36c.pdf b/storage/app/public/attachments/auto_7894/0d837284-c3e4-4e87-8d12-0e78cd50b36c.pdf new file mode 100644 index 0000000..a3c2ab8 Binary files /dev/null and b/storage/app/public/attachments/auto_7894/0d837284-c3e4-4e87-8d12-0e78cd50b36c.pdf differ diff --git a/storage/app/public/attachments/auto_7894/4622a635-3b3a-4c69-b4ff-dcca683af558.pdf b/storage/app/public/attachments/auto_7894/4622a635-3b3a-4c69-b4ff-dcca683af558.pdf new file mode 100644 index 0000000..a62f084 Binary files /dev/null and b/storage/app/public/attachments/auto_7894/4622a635-3b3a-4c69-b4ff-dcca683af558.pdf differ diff --git a/storage/app/public/attachments/auto_7894/qr.png b/storage/app/public/attachments/auto_7894/qr.png new file mode 100644 index 0000000..7adf308 Binary files /dev/null and b/storage/app/public/attachments/auto_7894/qr.png differ diff --git a/storage/app/public/attachments/auto_7895/4a2d9217-d83b-4c0f-bfc2-1572a378c506.pdf b/storage/app/public/attachments/auto_7895/4a2d9217-d83b-4c0f-bfc2-1572a378c506.pdf new file mode 100644 index 0000000..c88e3e6 Binary files /dev/null and b/storage/app/public/attachments/auto_7895/4a2d9217-d83b-4c0f-bfc2-1572a378c506.pdf differ diff --git a/storage/app/public/attachments/auto_7895/52a9e782-7be7-4a16-8500-9058893e8cbb.pdf b/storage/app/public/attachments/auto_7895/52a9e782-7be7-4a16-8500-9058893e8cbb.pdf new file mode 100644 index 0000000..2a5f888 Binary files /dev/null and b/storage/app/public/attachments/auto_7895/52a9e782-7be7-4a16-8500-9058893e8cbb.pdf differ diff --git a/storage/app/public/attachments/auto_7895/5b74154b-dc0f-4c4b-b262-09012ded632b.pdf b/storage/app/public/attachments/auto_7895/5b74154b-dc0f-4c4b-b262-09012ded632b.pdf new file mode 100644 index 0000000..54d007e Binary files /dev/null and b/storage/app/public/attachments/auto_7895/5b74154b-dc0f-4c4b-b262-09012ded632b.pdf differ diff --git a/storage/app/public/attachments/auto_7895/d5cadfe1-862c-406b-a37a-9f024ffdbc24.pdf b/storage/app/public/attachments/auto_7895/d5cadfe1-862c-406b-a37a-9f024ffdbc24.pdf new file mode 100644 index 0000000..97d3361 Binary files /dev/null and b/storage/app/public/attachments/auto_7895/d5cadfe1-862c-406b-a37a-9f024ffdbc24.pdf differ diff --git a/storage/app/public/attachments/auto_7895/f0077991-c90d-45b3-b5db-aaf3f611400d.pdf b/storage/app/public/attachments/auto_7895/f0077991-c90d-45b3-b5db-aaf3f611400d.pdf new file mode 100644 index 0000000..25983e1 Binary files /dev/null and b/storage/app/public/attachments/auto_7895/f0077991-c90d-45b3-b5db-aaf3f611400d.pdf differ diff --git a/storage/app/public/attachments/auto_7895/qr.png b/storage/app/public/attachments/auto_7895/qr.png new file mode 100644 index 0000000..ca133c5 Binary files /dev/null and b/storage/app/public/attachments/auto_7895/qr.png differ diff --git a/storage/app/public/attachments/estate_8179/1d9be8d3-b4bf-48f0-907c-f94eb472868c.pdf b/storage/app/public/attachments/estate_8179/1d9be8d3-b4bf-48f0-907c-f94eb472868c.pdf new file mode 100644 index 0000000..ddba9a7 Binary files /dev/null and b/storage/app/public/attachments/estate_8179/1d9be8d3-b4bf-48f0-907c-f94eb472868c.pdf differ diff --git a/storage/app/public/attachments/estate_8179/qr.png b/storage/app/public/attachments/estate_8179/qr.png new file mode 100644 index 0000000..c5f5383 Binary files /dev/null and b/storage/app/public/attachments/estate_8179/qr.png differ