From 0318fed3bb14a703771db872dcad969cedb8c771 Mon Sep 17 00:00:00 2001 From: David Doligalski Date: Tue, 28 May 2013 17:24:20 -0400 Subject: [PATCH] ---------------------------------------- * CRM-12710: Eliminate extra blank page from end of PDF labels (badges) http://issues.civicrm.org/jira/browse/CRM-12710 --- CRM/Utils/PDF/Label.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/CRM/Utils/PDF/Label.php b/CRM/Utils/PDF/Label.php index 20fef72064..19b873c9c8 100644 --- a/CRM/Utils/PDF/Label.php +++ b/CRM/Utils/PDF/Label.php @@ -213,6 +213,13 @@ class CRM_Utils_PDF_Label extends TCPDF { * function to Print a label */ function AddPdfLabel($texte) { + if ($this->countX == $this->xNumber) { + // Page full, we start a new one + $this->AddPage(); + $this->countX = 0; + $this->countY = 0; + } + $posX = $this->marginLeft + ($this->countX * ($this->width + $this->xSpace)); $posY = $this->marginTop + ($this->countY * ($this->height + $this->ySpace)); $this->SetXY($posX + $this->paddingLeft, $posY + $this->paddingTop); @@ -229,17 +236,6 @@ class CRM_Utils_PDF_Label extends TCPDF { $this->countX++; $this->countY = 0; } - - if ($this->countX == $this->xNumber) { - // Page full, we start a new one - $this->countX = 0; - $this->countY = 0; - } - - // We are in a new page, then we must add a page - if (($this->countX == 0) and ($this->countY == 0)) { - $this->AddPage(); - } } function getFontNames() { -- 2.25.1