note 54229 added to function.pdf-continue-text
| From: | stephenatthelonecoderdotcom at osu1 dot php dot net | Date: | Tue, 28 Jun 2005 03:06:35 +0000 |
| Subject: | note 54229 added to function.pdf-continue-text | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91047@lists.php.net to get a copy of this message | ||
For wrapping text in pdf this is the method that I have been using .
It handles variable font and sizes and also variable widths on the paragraph.
<?php
$c = $db->row['content'];
$color = convert_hexcolor_rgbdec($color_hex);
pdf_setcolor($pdf, 'both', 'rgb', $color['r'], $color['g'],
$color['b']);
$font = pdf_findfont($pdf, "$fontStyle", "host", 1);
pdf_setfont($pdf, $font, $s);
$par1 = stripslashes($c);
$j = 0;
$n = 0;
while($j < $pw && $c != "") {
$f = substr($par1, $n, 1);
$fWidth = pdf_stringwidth($pdf, "$f", 1, $s);
$j = $j + $fWidth;
$fWidth = 0;
$n++;
}
$wrap = $n;
$lead = $s + 2;
$paragraph = wordwrap($paragraph, $wrap, "***");
$parArr = explode("***", $paragraph);
pdf_show_xy($pdf, "$parArr[0]", $x, $y);
pdf_set_leading($pdf, $lead);
$i = 1;
while($parArr[$i]) {
pdf_continue_text($pdf, "$parArr[$i]");
$i++;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.pdf-continue-text.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54229
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54229&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54229&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54229&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54229&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54229&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54229&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54229&report=yes
Search -- http://master.php.net/manage/user-notes.php