From a08726199e0d4ce8e9b91c0cb80445d76b198718 Mon Sep 17 00:00:00 2001 From: Laurent Minguet Date: Wed, 15 Dec 2021 17:43:38 +0100 Subject: [PATCH] revert fix multibyte aware substr when setting newline position - it causes pbs on some specific cases --- CHANGELOG.md | 2 +- src/Html2Pdf.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 744c988..b19e6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. ## [5.2.4](https://github.com/spipu/html2pdf/compare/v5.2.3...master) - unreleased - * nothing for now + * revert fix multibyte aware substr when setting newline position - it causes pbs on some specific cases ## [5.2.3](https://github.com/spipu/html2pdf/compare/v5.2.2...v5.2.3) - 2021-10-19 diff --git a/src/Html2Pdf.php b/src/Html2Pdf.php index d7f7647..de51b3d 100755 --- a/src/Html2Pdf.php +++ b/src/Html2Pdf.php @@ -1036,7 +1036,7 @@ protected function _setNewPositionForNewLine($curr = null) if ($curr !== null && $sub->parsingHtml->code[$this->_parsePos]->getName() === 'write') { $txt = $sub->parsingHtml->code[$this->_parsePos]->getParam('txt'); $txt = str_replace('[[page_cu]]', $sub->pdf->getMyNumPage($this->_page), $txt); - $sub->parsingHtml->code[$this->_parsePos]->setParam('txt', mb_substr($txt, $curr + 1, null, $this->_encoding)); + $sub->parsingHtml->code[$this->_parsePos]->setParam('txt', substr($txt, $curr + 1)); } else { $sub->_parsePos++; } @@ -1505,7 +1505,8 @@ protected function _drawImage($src, $subLi = false) { // get the size of the image // WARNING : if URL, "allow_url_fopen" must turned to "on" in php.ini - if( strpos($src,'data:') === 0 ) { + + if (strpos($src,'data:') === 0) { $src = base64_decode( preg_replace('#^data:image/[^;]+;base64,#', '', $src) ); $infos = @getimagesizefromstring($src); $src = "@{$src}";