note 25025 added to function.cpdf-rect
| From: | mikkel at hostpartner dot dk | Date: | Sun, 08 Sep 2002 12:29:47 +0000 |
| Subject: | note 25025 added to function.cpdf-rect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36335@lists.php.net to get a copy of this message | ||
To draw a rectangle, remember to set the fill color using the function cpdf_setrgbcolor(int pdf
document, float red color, float green color, float blue color); before calling the cpdf_rect()
function.
After calling the cpdf_rect() function, call the cpdf_fill(int pdf document), to fill the rectangle.
Example:
<?php
$cpdf = cpdf_open(0);
cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0);
// Set the fill color (grey)
cpdf_setrgbcolor($cpdf, 0.9, 0.9, 0.9);
// Draw a rectangle (x-coor 645, y-coor 400, height 180, width 180)
cpdf_rect($cpdf, 645, 400, 180, 180);
// Fill the rectangle
cpdf_fill($cpdf);
cpdf_finalize($cpdf);
Header("Content-type: application/pdf");
cpdf_output_buffer($cpdf);
cpdf_close($cpdf);
?>
Notice that the color set with the cpdf_setrgbcolor(), as mentioned above, is used until another
color is applied to the document.
--
http://www.php.net/manual/en/function.cpdf-rect.php
http://master.php.net/manage/user-notes.php?action=edit+25025
http://master.php.net/manage/user-notes.php?action=delete+25025
http://master.php.net/manage/user-notes.php?action=reject+25025