Issues

ZF-1671: explain how to change font color

Issue Type: Docs: Improvement Created: 2007-07-02T13:55:40.000+0000 Last Updated: 2010-11-19T11:50:54.000+0000 Status: Resolved Fix version(s): - 1.11.1 (30/Nov/10)

Reporter: Michael Long (phareous) Assignee: Marc Hodgins (mjh_ca) Tags: - Zend_Pdf

Related issues: Attachments: - ZF-1671.patch

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:

<pre class="highlight">
$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

Posted by Willie Alberty (willie) on 2007-09-26T20:17:44.000+0000

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

<pre class="highlight">
$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.

Posted by Wil Sinclair (wil) on 2008-11-25T16:53:30.000+0000

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.

Posted by Willie Alberty (willie) on 2008-11-25T16:55:42.000+0000

Assigning to Alexander for documentation update.

Posted by Marc Hodgins (mjh_ca) on 2010-11-05T01:11:02.000+0000

Patch to documentation attached.

Posted by Marc Hodgins (mjh_ca) on 2010-11-19T11:50:54.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts