From 1e1f9905d13c6663b5cadd1f2e6c0674cc5dbe47 Mon Sep 17 00:00:00 2001 From: jhonnycgarcia Date: Wed, 6 Jun 2018 12:02:44 -0400 Subject: [PATCH 1/2] Issue#101 Correcion del constructor para la lectura de las variables `$xpos` y `$ypos` en la opcion 'image'. --- src/Cezpdf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cezpdf.php b/src/Cezpdf.php index 3178c96..459d7f6 100644 --- a/src/Cezpdf.php +++ b/src/Cezpdf.php @@ -377,7 +377,7 @@ protected function setBackground() $xpos = $this->ezBackground['xpos']; } - $this->addBackgroundImage($xpos, $ypos); + $this->addBackgroundImage($this->ezBackground['xpos'],$this->ezBackground['ypos']); if ($this->ezBackground['repeat'] & 1) { // repeat-x $numX = ceil($this->ez['pageWidth'] / $this->ezBackground['width']); From 8dd217cb8f29b41819ec179b7a5302853428c1d1 Mon Sep 17 00:00:00 2001 From: ole Date: Wed, 6 Jun 2018 22:46:48 +0200 Subject: [PATCH 2/2] fixed issue #101 and corrected repeating background --- src/Cezpdf.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Cezpdf.php b/src/Cezpdf.php index 459d7f6..ac5c41a 100644 --- a/src/Cezpdf.php +++ b/src/Cezpdf.php @@ -367,30 +367,30 @@ protected function setBackground() } break; case 'image': - $ypos = 0; + $ypos = $this->ezBackground['ypos']; + $xpos = $this->ezBackground['xpos']; + if ($this->ezBackground['repeat'] == 1) { - $ypos = $this->ezBackground['ypos']; + $xpos = 0; } - - $xpos = 0; + if ($this->ezBackground['repeat'] == 2) { - $xpos = $this->ezBackground['xpos']; + $ypos = 0; } - $this->addBackgroundImage($this->ezBackground['xpos'],$this->ezBackground['ypos']); + $this->addBackgroundImage($xpos, $ypos); if ($this->ezBackground['repeat'] & 1) { // repeat-x $numX = ceil($this->ez['pageWidth'] / $this->ezBackground['width']); - for ($i = 1; $i <= $numX; ++$i) { + for ($i = 0; $i < $numX; ++$i) { $xpos = ($this->ezBackground['width'] * $i); $this->addBackgroundImage($xpos, $ypos); } } - $xpos = 0; if ($this->ezBackground['repeat'] & 2) { // repeat-y $numY = ceil($this->ez['pageHeight'] / $this->ezBackground['height']); - for ($i = 1; $i <= $numY; ++$i) { + for ($i = 0; $i < $numY; ++$i) { $ypos = ($this->ezBackground['height'] * $i); $this->addBackgroundImage($xpos, $ypos); } @@ -400,9 +400,9 @@ protected function setBackground() $numX = ceil($this->ez['pageWidth'] / $this->ezBackground['width']); $numY = ceil($this->ez['pageHeight'] / $this->ezBackground['height']); - for ($i = 1; $i <= $numX; ++$i) { + for ($i = 0; $i < $numX; ++$i) { $xpos = ($this->ezBackground['width'] * $i); - for ($j = 1; $j <= $numY; ++$j) { + for ($j = 0; $j < $numY; ++$j) { $ypos = ($this->ezBackground['height'] * $j); $this->addBackgroundImage($xpos, $ypos); }