Skip to content

Commit

Permalink
revert fix multibyte aware substr when setting newline position - it …
Browse files Browse the repository at this point in the history
…causes pbs on some specific cases
  • Loading branch information
spipu committed Dec 15, 2021
1 parent 81d4006 commit a087261
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/Html2Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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}";
Expand Down

0 comments on commit a087261

Please sign in to comment.