Name

wrap_line -- Break off single line of text from a text string

Synopsis

string wrap_line ( string string, float width[, array param])

Description

This function takes a text string and breaks off enough words to fit within with width specified.

When a single word is too long to fit on a line, that word is returned by itself.

string is modified to contain the remainder of the string (minus the value returned).

The param array is used to determine font and font size. If omitted, default values are used.

Examples

Breaks the string $data into an array of strings, none of which will be greater than 200 PDF units wide.

while (strlen($data) > 0) {
    $strings[] = $pdf->wrap_line($data, 200);
}

See Also

History

The wrap_line() function was added in version 1.14

Bugs

Single words too long for a line are placed on a line by themselves. Error code 3001 is pushed onto the error stack, but false is not returned when this occurs. Methods that rely on this method for string handling (such as ->draw_paragraph()) will behave in the same manner.