note 38393 added to function.pdf-stringwidth
| From: | sa_kelkar at yahoo dot com | Date: | Fri, 19 Dec 2003 05:33:36 +0000 |
| Subject: | note 38393 added to function.pdf-stringwidth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62207@lists.php.net to get a copy of this message | ||
This will align the text in center of the start and end position pass to function. It works for only
2 ines. i try to convert it in recursive but i can't so help me for this
regards
function central($pdf,$xstart,$xend,$string,$y)
{
//sa_kelkar@yahoo.com
// if any one can convert itto recursive then please mail back
$dd=pdf_stringwidth ($pdf,trim($string));
$diff=$xend-$xstart;
if ($dd<$diff)
{
$x=$diff/2-$dd/2;
pdf_show_xy($pdf,$string,$x,$y);
}
else
{
$dd1=0;
for ($z=1;$dd1<$diff;$z++)
{
$Tstring=substr($string,0,$z);
$dd1=pdf_stringwidth($pdf,$Tstring);
}
$kk=substr($string,0,$z);//strlen($Tstring));
pdf_show_xy($pdf,$kk,$xstart,$y);
$dd1=pdf_stringwidth ($pdf,trim(substr($string,$z)));
$x=$diff/2-$dd1/2;
pdf_show_xy($pdf,substr($string,$z),$x,$y-20);
}
}
----
Manual Page -- http://www.php.net/manual/en/function.pdf-stringwidth.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38393
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38393&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38393&report=yes
Search -- http://master.php.net/manage/user-notes.php