note 31013 added to ref.cpdf
| From: | puterasalji at yahoo dot com | Date: | Mon, 07 Apr 2003 01:32:01 +0000 |
| Subject: | note 31013 added to ref.cpdf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46292@lists.php.net to get a copy of this message | ||
I've finally found a way to display text
<?php
$radius = 200;
$margin = 20;
$pagecount = 1;
$pdf = cpdf_open(0);
cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0);
cpdf_translate($pdf, $radius + $margin, $radius + $margin);
cpdf_begin_text($pdf);
cpdf_set_font($pdf, "Arial", 30, "NULL");
cpdf_set_text_rendering($pdf, 1);
cpdf_text($pdf, "Yahoo!!", -198, 50);
cpdf_end_text($pdf);
/* minute strokes*/
for ($alpha = 0; $alpha < 90; $alpha += 6)
{
cpdf_setrgbcolor($pdf,9.0,9.0,0.0);
cpdf_rotate($pdf, 6.0);
cpdf_moveto($pdf, $radius, 0.0);
cpdf_lineto($pdf, $radius-$margin/3, 0.0);
cpdf_stroke($pdf);
}
cpdf_finalize($pdf);
Header("Content-type: application/pdf");
cpdf_output_buffer($pdf);
cpdf_close($pdf);
?>
I'm not sure why, but the text appeared only after I've pasted the minute strokes draw
function from clock.php example. I user the cpdf_translate to begin the x,y coordinate in the middle
of the document
--
http://www.php.net/manual/en/ref.cpdf.php
http://master.php.net/manage/user-notes.php?action=edit+31013
http://master.php.net/manage/user-notes.php?action=delete+31013
http://master.php.net/manage/user-notes.php?action=reject+31013