From b62e32cfcb07ddb6ed940ad93f9c95e97abd782e Mon Sep 17 00:00:00 2001 From: Kevin Rudissaar Date: Wed, 6 Dec 2017 19:00:21 +0000 Subject: [PATCH] Added GetPageHeight and GetPageWidth methods to FPDFPlus class. --- FPDFPlus.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/FPDFPlus.php b/FPDFPlus.php index 84504c1..56408a8 100644 --- a/FPDFPlus.php +++ b/FPDFPlus.php @@ -21,11 +21,37 @@ public function WriteLn($height, $text, $link = '') /** * * @param float|null $height - * @param string $hmtl + * @param string $html * @param string $link */ public function WriteHtml($height, $html, $link = '') { $this->WriteLn($height, strip_tags($html), $link); } + + /** + * + * @return float + */ + public function GetPageHeight() + { + $height = $this->h; + $topMargin = $this->tMargin; + $bottomMargin = $this->bMargin; + + return (float) ($height - $topMargin - $bottomMargin); + } + + /** + * + * @return float + */ + public function GetPageWidth() + { + $width = $this->w; + $leftMargin = $this->lMargin; + $rightMargin = $this->rMargin; + + return (float) ($width - $rightMargin - $leftMargin); + } }