note 31624 added to function.pdf-setcolor

From: Date: Mon, 28 Apr 2003 13:25:57 +0000
Subject: note 31624 added to function.pdf-setcolor
Groups: php.notes 
Request: Send a blank email to php-notes+get-47205@lists.php.net to get a copy of this message
Bonjour, Cette fonction est utilisable pour définir une couleur de police. Hello, I search for the way of setting colors for the font in pdf and I find this. Hope it could help. <?php /** * set font color * maurice.anglebert@free.fr */ // path for the pdf file and string to show $pdfFilePath = $_SERVER[DOCUMENT_ROOT]."/the_dir_of_the_file/test.pdf"; $string = "The new color of my font"; $pdf = pdf_new(); pdf_open_file($pdf, $pdfFilePath); pdf_set_info($pdf, "Title", "Test pdf"); // A4 page pdf_begin_page($pdf, 595, 842); // set up of the font $font = pdf_findfont($pdf, "Courier", "host", FALSE); if (isset($font)) { pdf_setfont($pdf, $font, 10) or die ("unknown font"); } pdf_setColor($pdf, "fill", "rgb",0, 0, 1); // this for blue color // pdf_setColor($pdf, "fill", "rgb",1, 0, 0) for red pdf_set_value($pdf, "textrendering", 0); // show at the top of the page center pdf_show_boxed($pdf, $string, 0, 832, 595, 10, "center", ""); // resets graphic state pdf_initGraphics($pdf); // end of page and pdf_object pdf_end_page($pdf); pdf_close($pdf); pdf_delete($pdf); // use header to get the file header("Content-type: application/pdf"); header("Content-length: ".filesize($pdfFilePath)); header("Content-disposition: inline; filename=test.pdf"); readfile($pdfFilePath); ?> -- http://www.php.net/manual/en/function.pdf-setcolor.php http://master.php.net/manage/user-notes.php?action=edit+31624 http://master.php.net/manage/user-notes.php?action=delete+31624 http://master.php.net/manage/user-notes.php?action=reject+31624

« previous php.notes (#47205) next »