Merge pull request #13603 from pradpnayak/AdvMailin
[civicrm-core.git] / CRM / Utils / PDF / Label.php
index 0f6a613feb8c35815e0a63bea435fecc864a806b..b2f9c977514bcfdda78de1672dcd9d9cfed06381 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -30,7 +30,7 @@
  * functionality and smarts to the base PDF_Label.
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 
 /**
@@ -184,8 +184,10 @@ class CRM_Utils_PDF_Label extends TCPDF {
    * @param string $text
    */
   public function generateLabel($text) {
+    // paddingLeft is used for both left & right padding so needs to be
+    // subtracted twice from width to get the width that is available for text
     $args = array(
-      'w' => $this->width,
+      'w' => $this->width - 2 * $this->paddingLeft,
       'h' => 0,
       'txt' => $text,
       'border' => 0,