Skip to content

Commit

Permalink
fix align bug
Browse files Browse the repository at this point in the history
  • Loading branch information
spipu committed May 17, 2017
1 parent 0f54b4a commit 0730b90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Html2Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ protected function _setNewPositionForNewLine($curr = null)
$sub->_saveMargin(0, 0, $sub->pdf->getW()-$wMax);
$sub->_isForOneLine = true;
$sub->_parsePos = $this->_parsePos;
$sub->parsingHtml->code = $this->parsingHtml->code;
$sub->parsingHtml->code = $this->parsingHtml->getCloneCodes();

// if $curr => adapt the current position of the parsing
if ($curr !== null && $sub->parsingHtml->code[$this->_parsePos]->getName() == 'write') {
Expand Down
14 changes: 14 additions & 0 deletions src/Parsing/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ public function __construct(TextParser $textParser)
$this->code = array();
}

/**
* Get the list of the codes, but cloned
*
* @return Node[]
*/
public function getCloneCodes()
{
$codes = array();
foreach ($this->code as $key => $code) {
$codes[$key] = clone $code;
}
return $codes;
}

/**
* parse the HTML code
*
Expand Down

0 comments on commit 0730b90

Please sign in to comment.