public function pdf_word_wrap( $text = '', $line_length = 60 )
{
if($text)
{
$tmp_text = '';
$tmp_text_array = array();
$total_chars = strlen($text);
$text_array = explode(' ', $text);
// create array of lines of minimum length
foreach($text_array AS $snippet)
{
$tmp_text .= $snippet.' ';
if (strlen($tmp_text) >= $line_length)
{
$tmp_text_array[] = trim($tmp_text);
$tmp_text = '';
}
}
if (strlen($tmp_text) > 0)
{
$tmp_text_array[] = trim($tmp_text);
}
return $tmp_text_array;
}
else
{
return FALSE;
}
}
Created
December 12, 2012 15:36
-
-
Save esilvas/4268767 to your computer and use it in GitHub Desktop.
Word wrap with new-lines
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment