php 类 Cezpdf 中的完整理由

我正在使用 Cezpdf 类来生成一些 pdf。这些段落看起来是对齐的,但段落的最后一行应该是左对齐的。使用我当前的代码


while ($ix < count($string_array)){

    $pdf->ezText("$string_array[$ix]", 13, array('justification'=>'full'));

    $ix++;

除了最后一个段落之外,所有段落的最后一行都对齐,这看起来很奇怪,因为最后一段的最后一行左对齐,正如我对所有段落的期望一样。这种换行符有特殊字符吗?


我当前的三个相同段落的 pdf-Text 如下所示:

http://img3.mukewang.com/634911a80001fed809930200.jpg

肥皂起泡泡
浏览 66回答 1
1回答

大话西游666

仔细观察 ezText 函数会发现仅最后一段的对齐方式发生了变化,如我的示例所示。作为一种解决方法,我在每个段落/行的 for 循环之前保存了对齐输入,并删除了最后一段的单独处理:public function ezText($text, $size = 0, $options = array(), $test = 0)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;...&nbsp; &nbsp; &nbsp; &nbsp; $justification_Input = $just;&nbsp; &nbsp; &nbsp; &nbsp; for ($i = 0; $i < $c; $i++) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $just = $justification_Input;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $line = $lines[$i];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $start = 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (strlen($line) || $start) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($just == 'full'){ // && $c == $i + 1) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tmp = $this->addText($left, $this->y, $size, $line, $right - $left, $just, 0, 0, 1);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!strlen($tmp)) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $just = "left";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...
打开App,查看更多内容
随时随地看视频慕课网APP