Zend
  Home arrow Zend arrow Page 2 - 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 
eWeek
 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

    Speeding Shipping, Improving Compliance – Read the ScanCode Systems Case Study

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


    We have two different color settings to consider. The $_fill_color variable refers to the “non-stroke” color which is applied to fills and text. The $_draw_color variable is the “stroke” color applied to lines.

    The following function will set the fill color:


    function setFillColor($cs 'rgb'$c1$c2 0$c3 0$c4 0
    {
    $cs 
    strtolower($cs);
     
    if ($cs 'rgb') {
      
    /* Using a three component RGB color. */ 
      $this
    ->_fill_color sprintf('%.3f %.3f %.3f rg'$c1$c2$c3); 
      

    elseif 
    ($cs 'cmyk') { 
            
    /* Using a four component CMYK color. */ 
            $this
    ->_fill_color sprintf('%.3f %.3f %.3f %.3f k'$c1$c2$c3$c4); 
        
    } else { 
            
    /* Grayscale one component color. */ 
            $this
    ->_fill_color sprintf('%.3f g'$c1); 
        

        
    /* If document started output to buffer. */ 
        
    if ($this->_page 0) { 
            $this
    ->_out($this->_fill_color); 
        




    Notice that we need to pass varying number of color components depending on the colorspace selected: one for grayscale, or several for full color.

    Grayscale colors are represented by a single 3 decimal place number followed by the letter 'g'. 0 is black, 1 is white, with a whole lot of shades of gray in between.

    For example:
    '0.000 g' = black, eg. setFillColor('gray', 0)
    '0.200 g' = 20% gray, eg. setFillColor('gray', 0.2)
    '0.800 g' = 80% gray, eg. setFillColor('gray', 0.8)

    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

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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