Issues

ZF-1671: explain how to change font color

Description

The PDF docs don't really explain how to set font color. It appears the only way to do it is to create a new Style, and then set the font and color that way, as in:


$style = new Zend_Pdf_Style();
$style->setFillColor(new Zend_Pdf_Color_HTML('#000077'));
$style->setFont(Zend_Pdf_font::fontWithName(Zend_pdf_font::FONT_HELVETICA),10);
$page->setStyle($style);

It might also be helpful to modify the color section of the manual to explicitly list where color can be used (i.e. within a style object, and not in a page object, etc.)

Comments

As with any other PDF drawing operations, text is drawn using the current fill color of the content stream's (page's) graphic state:


$page->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));  // red

{{Zend_Pdf_Style}} objects allow you to set multiple attributes of the graphics state at once, but are not required.

Does this information belong in the reference guide? If so, could you please add it or reassign to Alex, Willie? Otherwise resolve it as 'not an issue'. Thanks.

Assigning to Alexander for documentation update.

Patch to documentation attached.

Patch applied to trunk in r23406, merged to 1.11 release branch in r23407