Downloads
Overview Search Downloads Up
Download details
TWFPDF Version:1.0
(0 votes)

This FPDF extension will provide you with several utility functions to assist in the layout and generation of PDF files from within your PHP projects.

Installation

  1. Copy the "twfpdf.php" file into the same directory as the FPDF files (not included).
  2. Include this class in your project after including the base FPDF class:
    require ('fpdf.php');
    require ('twfpdf.php');
  3. Use the TWFPDF class to instantiate your PDF object.  You can use all the standard FPDF arguments (e.g. orientation, unit size, etc.)
    $pdf = new TWFPDF();

    Alternately; extend this class to add your own mods:
    class MyPDF extends TWFPDF { ... }
  4. Use the standard FPDF function calls to build your PDF file.

Usage

drawLayoutGrid

This function will draw a grid on the page and automatically adjusts to the page orientation and size.

drawLayoutGrid($lineColor, $colWidth, $rowHeight, $hiliteCol, $colHiliteColor, $hiliteRow, $rowHiliteColor, $showMargins)

This function accpets the following parameters:

  • $lineColor The color to use for the lines.  Can be a string of RGB values '0,0,0', an array of RGB values array(0,0,0), or a hex color value #000 or #000000.  If a single value is given it is treated as a greyscale value (e.g. 0).  Default '0,0,0' (black).
  • $colWidth The interval at which to draw the vertical (column) lines.  Default 10.
  • $rowHeight The interval at which to draw the horizontal (row) lines.  Default 10.
  • $hiliteCol The interval at which to draw a hilited vertical (column) line.  Default 100.
  • $colHiliteColor The color to use for the hilited vertical (column) lines.  Can be a string of RGB values '0,0,0', an array of RGB values array(0,0,0), or a hex color value #000 or #000000.  If a single value is given it is treated as a greyscale value (e.g. 0).  Default '0,0,0' (black).
  • $hiliteRow The interval at which to draw a hilited horizontal (row) line.  Default 100.$rowHiliteColor The color to use for the hilited horizontal (row) lines.  Can be a string of RGB values '0,0,0', an array of RGB values array(0,0,0), or a hex color value #000 or #000000.  If a single value is given it is treated as a greyscale value (e.g. 0).  Default '0,0,0' (black).
  • $showMargins If TRUE the grid lines will be 'inside' the margins.  If FALSE the grid lines will cover the whole page width/height.  Default TRUE.

getDrawColor

This function will return the currently set drawing color.  If the drawing color has not yet been set this function will return FALSE.

getDrawColor();

This function accepts no parameters and the value returned will be a numerically indexed array of RGB values.  This array may contain either 3 elements representing the R,G,B values (0 - 255) or a single element denoting a greyscale value (0 - 255).

 

getFillColor

This function will return the currently set fill color.  If the fill color has not yet been set this function will return FALSE.

getFillColor();

This function accepts no parameters and the value returned will be a numerically indexed array of RGB values.  This array may contain either 3 elements representing the R,G,B values (0 - 255) or a single element denoting a greyscale value (0 - 255).

 

getTextColor

This function will return the currently set text color.  If the text color has not yet been set this function will return FALSE.

getTextColor();

This function accepts no parameters and the value returned will be a numerically indexed array of RGB values.  This array may contain either 3 elements representing the R,G,B values (0 - 255) or a single element denoting a greyscale value (0 - 255).

Examples

The following examples demonstrate several different ways to call the drawLayoutGrid function.  There are also examples included which are taken directly from the FPDF examples to demonstrate that standard FPDF functionality is not affected.

Note: All examples will open in a new window and produce a PDF document.  You must have a PDF reader (such as Adobe Reader) installed to view these examples.

Changelog

v1.0: Initial public release




Data

System See description
Size 7 KB
Downloads 478
Language English
License
Created 2012-01-17 14:47:59
Changed at 2012-01-17 09:35:56

Download