Hi, I've got the following little function:

public function addText($pdf, $xPos, $yPos, $schriftgroese, $text){
/**
* @description: Returning Text with automatic linebreak
*/

$heuhaufen = $text;
for ($i=0; $i < substr_count($heuhaufen, "\n") + 1; $i++){
        $posStr= stripos ($heuhaufen,"\n");
        $text = substr ($heuhaufen, 0, $posStr);
        $heuhaufen = substr ($heuhaufen, $posStr, 10000 );
         if ($posStr ==0)
                $text = $heuhaufen;

echo "<br>\n\t|||||||||||||||||| $i |||||||||||| $posStr
||||||||||||||||||||||| $text";
}
}



That gives me in HTML:
|||||||||||||||||| 0 |||||||||||| ||||||||||||||||||||||| Selbständiges Werk
|||||||||||||||||| 0 |||||||||||| ||||||||||||||||||||||| Zweigwerk
|||||||||||||||||| 0 |||||||||||| 19 |||||||||||||||||||||||
Tochtergesellschaft
|||||||||||||||||| 1 |||||||||||| 0 ||||||||||||||||||||||| eines Konzerns
oder einer Holding
|||||||||||||||||| 2 |||||||||||| 0 ||||||||||||||||||||||| eines Konzerns
oder einer Holding
|||||||||||||||||| 0 |||||||||||| ||||||||||||||||||||||| keine Angaben

But if I have look at the generated code it schows CORRECTLY
<br>
|||||||||||||||||| 0 |||||||||||| ||||||||||||||||||||||| Selbständiges
Werk<br>
|||||||||||||||||| 0 |||||||||||| ||||||||||||||||||||||| Zweigwerk<br>
|||||||||||||||||| 0 |||||||||||| 19 |||||||||||||||||||||||
Tochtergesellschaft<br>
|||||||||||||||||| 1 |||||||||||| 0 |||||||||||||||||||||||
eines Konzerns oder
einer Holding<br>
|||||||||||||||||| 2 |||||||||||| 0 |||||||||||||||||||||||
eines Konzerns oder
einer Holding<br>
|||||||||||||||||| 0 |||||||||||| ||||||||||||||||||||||| keine Angaben



The $text is preformated and checked it it's to wide for the desired place.
The Output is placed at x-y Coord. for PDF Output. My Qustion is:
Why for crying out loud, doesn't it cut the second time, the way it's
supposed to.

I just can't find the reason for this behavior.
        substr_count($heuhaufen, "\n")  is working
         stripos ($heuhaufen,"\n"); only the first time/ or the last line to
be returned?



Please help, I'm sitting on this for almost a day now.
thx Jan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to