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

 
Developer Updates  
Free Website Content 
 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? 
Google.com  
ZEND

PDFs with PHP part 2
By: Zend
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek