<?php
require('fpdf.php');
class PDF_Shadow extends FPDF
{
function ShadowCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $color='G', $distance=0.5)
{
if($color=='G')
$ShadowColor = 100;
elseif($color=='B')
$ShadowColor = 0;
else
$ShadowColor = $color;
$TextColor = $this->TextColor;
$x = $this->x;
$this->SetTextColor($ShadowColor);
$this->Cell($w, $h, $txt, $border, 0, $align, $fill, $link);
$this->TextColor = $TextColor;
$this->x = $x;
$this->y += $distance;
$this->Cell($w, $h, $txt, 0, $ln, $align);
}
}
?>
<?php
require('shadow.php');
$pdf = new PDF_Shadow();
$pdf->SetFont('Arial','',30);
$pdf->AddPage();
$pdf->SetTextColor(255, 255, 255);
for ($i = 1; $i < 6; $i++) {
$Text = sprintf('Gray shadow with %.1F distance', $i / 2);
$pdf->ShadowCell(0, 40, $Text, 1, 1, 'C', true, '', 'G', $i / 2);
$pdf->Ln(10);
}
$pdf->AddPage();
$pdf->SetTextColor(0, 0, 255);
for ($i = 1; $i < 6; $i++) {
$Text = sprintf('Black shadow with %.1F distance', $i / 2);
$pdf->ShadowCell(0, 40, $Text, 1, 1, 'C', false, '', 'B', $i / 2);
$pdf->Ln(10);
}
$pdf->Output();
?>
View the result