MDL-70376 mod_assign: Reintroduce pdf orientation check

Reintroduce the orientation check and sizing when importing an image
This commit is contained in:
Peter Dias
2021-08-31 12:28:32 +08:00
parent 1464843a25
commit 730defb1d1
+4 -3
View File
@@ -824,13 +824,14 @@ class pdf extends TcpdfFpdi {
$this->currentpage++;
$template = $this->importPage($this->currentpage);
$size = $this->getTemplateSize($template);
$orientation = 'P';
if ($imageinfo["width"] > $imageinfo["height"]) {
if ($size['width'] < $size['height']) {
$temp = $size['width'];
$size['width'] = $size['height'];
$size['height'] = $temp;
}
$orientation = 'L';
} else if ($imageinfo["width"] < $imageinfo["height"]) {
if ($size['width'] > $size['height']) {
$temp = $size['width'];
@@ -838,7 +839,7 @@ class pdf extends TcpdfFpdi {
$size['height'] = $temp;
}
}
$orientation = $size['orientation'];
$this->SetHeaderMargin(0);
$this->SetFooterMargin(0);
$this->SetMargins(0, 0, 0, true);
@@ -847,7 +848,7 @@ class pdf extends TcpdfFpdi {
$this->AddPage($orientation, $size);
$this->SetAutoPageBreak(false, 0);
$this->Image('@' . $imagecontent, 0, 0, $size['w'], $size['h'],
$this->Image('@' . $imagecontent, 0, 0, $size['width'], $size['height'],
'', '', '', false, null, '', false, false, 0);
}
}