0

I am using the Cezpdf Class to generate some pdfs. The paragraphs appear justified but the last line of the paragraphs should be left-justified. With my current code

while ($ix < count($string_array)){
    $pdf->ezText("$string_array[$ix]", 13, array('justification'=>'full'));
    $ix++;
} 

all paragraphs except of the last one have also their last line justified, which looks odd since the last paragraph has its last line left-justified, as I would expect from all paragraphs. Is there a special character for this kind of linebreak?

My current pdf-Text of three identical paragraphs looks as following:

enter image description here

Michi31
  • 23
  • 5

1 Answers1

0

Looking closely to the ezText function reveals a change in justification only for the last paragraph, as seen in my example. As a workaround I save the justification input before the for loop over each paragraph/line and deleted the separate handling of the last paragraph:

public function ezText($text, $size = 0, $options = array(), $test = 0)
    {
       ...

        $justification_Input = $just;
        for ($i = 0; $i < $c; $i++) {
            $just = $justification_Input;
            $line = $lines[$i];
            $start = 1;
            while (strlen($line) || $start) {

            ...

                if ($just == 'full'){ // && $c == $i + 1) {
                    $tmp = $this->addText($left, $this->y, $size, $line, $right - $left, $just, 0, 0, 1);
                    if (!strlen($tmp)) {
                        $just = "left";
                    }
                }

             ...
Michi31
  • 23
  • 5