diff --git a/vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php b/vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php index f96575db745..159a8136e0c 100644 --- a/vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php +++ b/vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php @@ -1066,7 +1066,7 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject if ($this->y - $itemsProp['shift'] < 15) { $page = $this->newPage($pageSettings); } - $this->correctLines($lines, $page, $height); + $page = $this->correctLines($lines, $page, $height); } return $page; @@ -1081,7 +1081,7 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject * @throws \Zend_Pdf_Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - private function correctLines($lines, $page, $height) :void + private function correctLines($lines, $page, $height) :\Zend_Pdf_Page { foreach ($lines as $line) { $maxHeight = 0; @@ -1108,12 +1108,16 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject if (!is_array($column['text'])) { $column['text'] = [$column['text']]; } - $top = $this->correctText($column, $height, $font, $page); + $textCorrection = $this->correctText($column, $height, $font, $page); + $top = $textCorrection['top']; + $page = $textCorrection['page']; $maxHeight = $top > $maxHeight ? $top : $maxHeight; } $this->y -= $maxHeight; } + + return $page; } /** @@ -1127,7 +1131,7 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject * @return int * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - private function correctText($column, $height, $font, $page) :int + private function correctText($column, $height, $font, $page) :array { $top = 0; $lineSpacing = !empty($column['height']) ? $column['height'] : $height; @@ -1160,6 +1164,6 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject $page->drawText($part, $feed, $this->y - $top, 'UTF-8'); $top += $lineSpacing; } - return $top; + return ['top' => $top, 'page' => $page]; } } diff --git a/vendor/magento/module-sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php b/vendor/magento/module-sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php index 7bb44b71fbc..fe0671901ac 100644 --- a/vendor/magento/module-sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php +++ b/vendor/magento/module-sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php @@ -71,7 +71,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte $lines[0] = [ [ // phpcs:ignore Magento2.Functions.DiscouragedFunction - 'text' => $this->string->split(html_entity_decode($item->getName()), 35, true, true), + 'text' => $this->string->split(html_entity_decode($item->getName()), 25, true, true), 'feed' => 35 ] ]; @@ -153,7 +153,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte } } - $lineBlock = ['lines' => $lines, 'height' => 20, 'shift' => 5]; + $lineBlock = ['lines' => $lines, 'height' => 20]; $page = $pdf->drawLineBlocks($page, [$lineBlock], ['table_header' => true]); $this->setPage($page);