From 8586dc44c6a45cff2fe03494357788edfe802425 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Fri, 22 Mar 2024 12:48:48 +0000 Subject: [PATCH] fix newline case --- examples/index.php | 2 ++ src/Text.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/index.php b/examples/index.php index d987004..58f6ef4 100644 --- a/examples/index.php +++ b/examples/index.php @@ -1083,6 +1083,7 @@ $txt3 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'."\n".'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'; +// single block of text $txtbox = $pdf->getTextCol( $txt3, 20, // float $posx = 0, @@ -1104,6 +1105,7 @@ ); $pdf->page->addContent($txtbox); +// block of text between two page regions $pdf->addTextCol( $txt3, 20, // float $posx = 0, diff --git a/src/Text.php b/src/Text.php index b47f84e..ccab67a 100644 --- a/src/Text.php +++ b/src/Text.php @@ -587,7 +587,7 @@ protected function splitLines( for ($word = 0; $word < $num_lines; $word++) { $data = $dim['split'][$word]; if (($data['septype'] == 'B') || (($data['totwidth'] - $prev_totwidth) >= $line_width)) { - if (($data['septype'] != 'B') && ($word > 0)) { + if (($word > 0) && (($data['totwidth'] - $prev_totwidth) >= $line_width)) { $data = $dim['split'][($word - 1)]; --$word; }