Zend
  Home arrow Zend arrow Page 3 - PDFs with PHP part 2
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ZEND

PDFs with PHP part 2
By: Zend
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2004-01-07

    Table of Contents:
  • PDFs with PHP part 2
  • Color
  • RGB Color
  • Line Drawing
  • Circles
  • Page Add Modifications
  • File Checking
  • Example Use

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    PDFs with PHP part 2 - RGB Color
    (Page 3 of 8 )


    Selecting 'rgb' and passing three color components gives us full color, represented by 3 separate 3-decimal-place numbers, followed by the letters 'rg'.
    So, for example:
    '0.800 0.400 0.200 rg' = purple-ish color. eg. setFillColor('rgb', 0.8, 0.4, 0.2)

    A second, very similar function sets the drawing color:

     
    function setDrawColor($cs 'rgb'$c1$c2 0$c3 0
                          $c4 
    0
    {    
        $cs 
    strtolower($cs); 
        
    if ($cs 'rgb') { 
            $this
    ->_draw_color sprintf('%.3f %.3f %.3f RG'
                                         $c1
    $c2$c3); 
        
    } elseif ($cs 'cmyk') { 
            $this
    ->_draw_color sprintf('%.3f %.3f %.3f %.3f K'
                                         $c1
    $c2$c3$c4); 
        
    } else { 
            $this
    ->_draw_color sprintf('%.3f G'$c1); 
        
    }    
        
    /* If document started output to buffer. */ 
        
    if ($this->_page 0) { 
            $this
    ->_out($this->_draw_color); 
        




    Note that the only difference between these two functions is the lowercase/uppercase syntax. 'g', 'rg', and 'k' specify fill color, while 'G', 'RG', and 'K', specify draw color.

    That's it! Calling either of these two functions will set the colors for any subsequent text or drawing output to your PDF document, and preserve that setting between pages.

    More Zend Articles
    More By Zend


     

       

    ZEND ARTICLES

    - Taking the Zend Certified PHP Engineer Exam:...
    - Quick Introduction to PHP 5
    - PHP SOAP Extension
    - Improving Performance
    - PDFs with PHP part 2
    - PDFs with PHP part 1
    - PHP at Lycos
    - Build Database Interfaces




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway