PHP
  Home arrow PHP arrow Drawing Basic Rectangles in PDF Docume...
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 
 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? 
PHP

Drawing Basic Rectangles in PDF Documents with PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 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:
      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.

    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


       · Over the course of this fourth part of the series, the functionality provided by the...
     

       

    PHP ARTICLES

    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery
    - Using Timers to Benchmark PHP Applications
    - Benchmarking Applications with PHP
    - Setting Up a Web-Based File Manager: PHPfile...
    - Developing a Modular Class For a PHP File Up...
    - Setting Up a Web-Based File Manager: bfExplo...
    - Defining a Custom Function for File Uploader...
    - Parsing Child Nodes with the DOM XML extensi...
    - Creating an Error Handling Module for a PHP ...
    - Accessing Attributes and Cloning Nodes with ...
    - Retrieving Information on Selected Files wit...
    - Handling HTML Strings and Files with the DOM...
    - Building File Uploaders with PHP 5
    - Working with Multiple Document Nodes with th...




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