Skip to content

Commit

Permalink
Possible fix for #148 and #157
Browse files Browse the repository at this point in the history
  • Loading branch information
ole1986 committed Apr 12, 2023
1 parent 4b4f2f6 commit e2c5edc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Cezpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,6 @@ public function ezTable(&$data, $cols = '', $title = '', $options = '')
$height = $this->getFontHeight($options['fontSize']);
$descender = $this->getFontDescender($options['fontSize']);

// $y0 = $y + $descender; // REPLACED THIS LINE WITH THE FOLLOWING
$y0 = $y - $options['rowGap'];
$dy = 0;
if ($options['showHeadings']) {
Expand Down Expand Up @@ -1637,7 +1636,6 @@ public function ezTable(&$data, $cols = '', $title = '', $options = '')

$this->setColor($options['textCol'][0], $options['textCol'][1], $options['textCol'][2], 1);
$y = ($options['nextPageY']) ? $nextPageY : ($this->ez['pageHeight'] - $this->ez['topMargin']);
// $y0 = $y + $descender; // REPLACED THIS LINE WITH THE FOLLOWING
$y0 = $y - $options['rowGap'];
$mx = 0;
if ($options['showHeadings']) {
Expand Down Expand Up @@ -1676,15 +1674,13 @@ public function ezTable(&$data, $cols = '', $title = '', $options = '')
$colNewPage = 0;
if (isset($row[$colName])) {
if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['link']) && strlen($options['cols'][$colName]['link'])) {
//$lines = explode("\n",$row[$colName]);
$lines = preg_split("[\r\n|\r|\n]", $row[$colName]);
if (isset($row[$options['cols'][$colName]['link']]) && strlen($row[$options['cols'][$colName]['link']])) {
foreach ($lines as $k => $v) {
$lines[$k] = '<c:alink:'.$row[$options['cols'][$colName]['link']].'>'.$v.'</c:alink>';
}
}
} else {
//$lines = explode("\n",$row[$colName]);
$lines = preg_split("[\r\n|\r|\n]", $row[$colName]);
}
} else {
Expand All @@ -1698,7 +1694,6 @@ public function ezTable(&$data, $cols = '', $title = '', $options = '')
if (isset($row[$colName.'Color'])) {
$textColor = $row[$colName.'Color'];
$this->setColor($textColor[0], $textColor[1], $textColor[2], true);
//$line = '<c:color:'.$textColor[0].','.$textColor[1].','.$textColor[2].'>'.$line . '</c:color>';
} else {
$this->setColor(0, 0, 0, true);
$this->setStrokeColor(0, 0, 0, true);
Expand Down Expand Up @@ -1951,7 +1946,7 @@ public function ezText($text, $size = 0, $options = [], $test = 0)
for ($i = 0; $i < $c; $i++) {
$line = $lines[$i];
$start = 1;
while (strlen($line) || $start) {
while ($l = strlen($line) || $start) {
$start = 0;
$this->y = $this->y - $height;
if ($this->y < $this->ez['bottomMargin']) {
Expand Down Expand Up @@ -1984,6 +1979,10 @@ public function ezText($text, $size = 0, $options = [], $test = 0)

$line = $this->addText($left, $this->y, $size, $line, $right - $left, $just, 0, 0, $test);

if ($l == strlen($line)) {
$line = '';
}

if (is_array($options) && isset($options['justification'])) {
// recover justification
$just = $options['justification'];
Expand Down

0 comments on commit e2c5edc

Please sign in to comment.