diff --git a/application/controllers/tools/Medical_checkup_report.php b/application/controllers/tools/Medical_checkup_report.php index a1f0da7e..6b0192c1 100644 --- a/application/controllers/tools/Medical_checkup_report.php +++ b/application/controllers/tools/Medical_checkup_report.php @@ -14,8 +14,21 @@ class MedicalCheckupReportPdf extends FPDF return; } - // Draw watermark background per page. - $this->Image($this->watermarkPath, 23, 102, 164, 102, 'JPEG'); + // Keep original image ratio to avoid stretched watermark. + $info = @getimagesize($this->watermarkPath); + if (!$info || intval($info[0]) <= 0 || intval($info[1]) <= 0) { + return; + } + + $imgW = intval($info[0]); + $imgH = intval($info[1]); + $drawW = 136.0; + $drawH = ($imgH / $imgW) * $drawW; + + // Position tuned to match lab report reference. + $x = ($this->GetPageWidth() - $drawW) / 2; + $y = 98.0; + $this->Image($this->watermarkPath, $x, $y, $drawW, $drawH, 'JPEG'); } public function Footer()