PHP
  Home arrow PHP arrow Drawing Basic Rectangles in PDF Documents with PHP 5
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  
PHP

Drawing Basic Rectangles in PDF Documents with PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2007-11-20


    Table of Contents:
  • Drawing Basic Rectangles in PDF Documents with PHP 5
  • Adding an image and a text flow to a PDF file
  • Drawing some basic rectangles
  • Displaying multiple rectangles on the same PDF file

  • 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


    Drawing Basic Rectangles in PDF Documents with PHP 5
    ( Page 1 of 4 )

    If you’re a PHP developer who’s searching for a friendly guide on how to build dynamic PDF files within your PHP 5-based applications, then look no further, and start reading this series now!

    Welcome to the fourth part of the series that began with “Building PDF documents with PHP 5.” Since PHP 5 comes packaged with robust capabilities for delivering database contents in a considerable variety of formats, including Adobe’s PDF (Portable Document Format), this series teaches you how to create this type of file with only minor hassles, directly from your own scripts.

    If you already read the two preceding tutorials of the series, you’ve acquired a solid background in building simple PDF documents with PHP 5. In those articles I covered the basics of this process, including the adequate implementation of the “set_text_pos()”, “show()”, and “continue_text()” methods that come integrated with the PDFLib library. I did this in order to display both single and multi-line texts, as well as incorporate some basic images into a given PDF document.

    Creating dynamic PDF files is a process reduced to spawning an instance of the already familiar PDFLib class, bundled with the homonymous library, and then calling the appropriate set of methods in accordance with the kind of tasks that must be performed on the file in question, such as opening a new document and a new page, adding some lines of text, including images, you name it.

    In addition, you’ll certainly recall that in the previous installment of the series I showed you how to create different blocks of text inside a determined PDF document, which in this context are called “text flows.” As you saw, these text flows are useful when you want to incorporate several paragraphs that have predefined dimensions -- that have specific widths and heights respectively.

    Regarding the incorporation of text flows into a given PDF document, I showed a concrete example of how to use a combination of the handy “create_text_flow()”, “fit_text_flow()”, and “delete_text_flow()” methods, to display a single block of text at a specific position within the pertinent document. Certainly this is a procedure that can be performed effortlessly, mostly because of the easy learning curve offered by the aforementioned methods.

    All right, now that you know how to include basic blocks of text into a simple PDF file, in addition to incorporating some images, the question that comes up here is: what’s the next step to take? Well, in this fourth part of the series I’m going to show you how to draw a few basic shapes, once a PDF document has been opened, like empty and filled rectangles, which can be useful if you want to decorate the document with these kinds of forms.

    Now, let’s get rid of the boring preliminaries and start learning more about how to draw a few simple rectangles in a specific PDF file. Let’s get going!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





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