note 59630 added to function.pdf-show-xy

From: Date: Sun, 11 Dec 2005 20:52:33 +0000
Subject: note 59630 added to function.pdf-show-xy
Groups: php.notes 
Request: Send a blank email to php-notes+get-99973@lists.php.net to get a copy of this message
Here's a little function that creates a pdf_show_xy_right() function with exactly the same parameters as pdf_show_xy(), except that the third parameter now specifies the right-aligned edge position. function pdf_show_xy_right(&$pdf, $text, $right, $bottom) { $fontname = pdf_get_parameter($pdf, "fontname", 0); $font = pdf_findfont($pdf, $fontname, "host", 0); $size = pdf_get_value($pdf, "fontsize", 0); $width = pdf_stringwidth($pdf, $text, $font, $size); pdf_show_xy($pdf, $text, $right-$width, $bottom); } Set your font name and size separately, just as you would with pdf_show_xy(), and then call this function like so: pdf_show_xy_right($pdf, "Hello World", 50, 200); The third parameter is the right edge, fourth parameter is the baseline. You do NOT have to pass in the font and size! ---- Manual Page -- http://www.php.net/manual/en/function.pdf-show-xy.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59630 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59630&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59630&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59630&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59630&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59630&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59630&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59630&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59630&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99973) next »