Depending on the colorspace called, the number of color component
parameters required can be either 1, 3 or 4. The method can be called
before the first page is created and the color is retained from page to
page.
public setFillColor ( string $cs = 'rgb', float $c1, float $c2, float $c3, float $c4 ) | ||
$cs | string | Indicates the colorspace which can be either 'rgb', 'hex', 'cmyk', or 'gray'. Defaults to 'rgb'. |
$c1 | float | First color component, floating point value between 0 and 1. Required for gray, rgb and cmyk. |
$c2 | float | Second color component, floating point value between 0 and 1. Required for rgb and cmyk. |
$c3 | float | Third color component, floating point value between 0 and 1. Required for rgb and cmyk. |
$c4 | float | Fourth color component, floating point value between 0 and 1. Required for cmyk. |
public function testTextColorUsingHex() { $pdf = new Horde_Pdf_Writer(); $pdf->setInfo('timestamp', $this->fixtureCreationDate()); $pdf->setCompression(false); $pdf->open(); $pdf->addPage(); $pdf->setFont('Helvetica', 'B', 48); $pdf->setDrawColor('hex', '#F00'); $pdf->setTextColor('hex', '#0F0'); $pdf->setFillColor('hex', '#00F'); $this->assertEquals('1.000 0.000 0.000 RG', $pdf->getDrawColor()); $this->assertEquals('0.000 1.000 0.000 rg', $pdf->getTextColor()); $this->assertEquals('0.000 0.000 1.000 rg', $pdf->getFillColor()); }