Keep medical watermark aspect ratio
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user