note 31670 added to function.pdf-setcolor
| From: | php at rack1 dot php dot net | Date: | Tue, 29 Apr 2003 21:22:40 +0000 |
| Subject: | note 31670 added to function.pdf-setcolor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47261@lists.php.net to get a copy of this message | ||
Here's a better implementation for setting HTML hexadecimal colors:
function pdf_setcolor_hex($hexcolor, $type = '')
{
global $pdf; ## match this to your pdf resource handle
$color['r'] = hexdec(substr($hexcolor, 0, 2))/255;
$color['g'] = hexdec(substr($hexcolor, 2, 2))/255;
$color['b'] = hexdec(substr($hexcolor, 4, 2))/255;
if ($type != 'fill' && $type != 'stroke') $type = 'both';
pdf_setcolor($pdf, $type, 'rgb', $color['r'], $color['g'],
$color['b']);
}
Sample usage:
pdf_setcolor_hex('FFFFFF', 'fill');
-Derek
--
http://www.php.net/manual/en/function.pdf-setcolor.php
http://master.php.net/manage/user-notes.php?action=edit+31670
http://master.php.net/manage/user-notes.php?action=delete+31670
http://master.php.net/manage/user-notes.php?action=reject+31670