Saturday, January 8, 2011

Transparent Images for FPDF

This post is really to help me remember the layers of FPDF class extensions I am using.
Remember that FPDF is a class defined in the fpdf.php file and contains many useful functions for manipulating pdf files. These functions can be called by the syntax

$pdfobject->function();

class FPDF_TPL extends FPDF
class FPDI extends FPDF_TPL
class AlphaPDF extends FPDI

The AlphaPDF class (alphapdf.php) is a small script courtesy of Martin Hall-May and is found at
http://www.fpdf.de/downloads/addons/74/
It was originally written as an extension of FPDF but I modified it to be an extension of FPDI so that my pdfobject can call functions both for purposes of importing PDF images, and superimposing gif images using the marvelous SetAlpha() function, as described below

// alpha: real value from 0 (transparent) to 1 (opaque)
// bm: blend mode, one of the following:
// Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn,
// HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity
function SetAlpha($alpha, $bm='Normal')

No comments:

Post a Comment