CakeFest 2017 NYC, the Official CakePHP Conference


(PHP 4, PECL pdflib >= 1.0.0)

PDF_setrgbcolor_fillEstablecer los valores de color rgb del relleno [obsoleta]


bool PDF_setrgbcolor_fill ( resource $p , float $red , float $green , float $blue )

Establece el color de relleno actual a los valores RGB proporcionados. Devuelve TRUE en caso de éxito o FALSE en caso de error.

Esta función está obsoleta desde la versión 4 de PDFlib, use PDF_setcolor() en su lugar.

add a note add a note

User Contributed Notes 2 notes

philipp dot maske at location-bretagne dot de
13 years ago
It took some time to understand, that the float values have to be beetween beetween 0 and 1. If you use graphic tools like color-pickers etc. it is necessary to convert the RGB values frome the scale of 1 to 255 to 0 to 1.

Use this small function to make your life easier:

function pdf_setrgbcolor_fill_better($intPdfObj, $intRed, $intGreen, $intBlue) {
  if($intRed<=0||$intRed>255|| $intGreen<=0|| $intGreen>255|| $intBlue<=0|| $intBlue>255) return false;

  $floatRed        = $intRed/255;
  $floatGreen      = $intGreen/255;
  $floatBlue       = $intBlue/255;

  return pdf_setrgbcolor_fill ($intPdfObj, $floatRed, $floatGreen, $floatBlue);

Have Fun!
maske at chiquadrat dot de
15 years ago
the double values for each RGB color start at '0' and end at '1'. So use e.g. pdf_setrgbcolor_fill(int pdf_document,1,1,1) for white, pdf_setrgbcolor_fill(int pdf_document,0,0,0) for black or something in between for a mixed color.
To Top