Her er uddrag af koden:
define('FPDF_FONTPATH','font/');
require('fpdf.php');
class PDF extends FPDF
{
var $B;
var $I;
var $U;
var $HREF;
function PDF($orientation='P',$unit='mm',$format='A4')
{
//Call parent constructor
$this->FPDF($orientation,$unit,$format);
//Initialization
$this->B=0;
$this->I=0;
$this->U=0;
$this->HREF='';
}
function WriteHTML($html)
{
//HTML parser
$html=str_replace("\n",' ',$html);
$a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
foreach($a as $i=>$e)
{
if($i%2==0)
{
//Text
if($this->HREF)
$this->PutLink($this->HREF,$e);
else
$this->Write(5,$e);
}
else
{
//Tag
if($e{0}=='/')
$this->CloseTag(strtoupper(substr($e,1)));
else
{
//Extract attributes
$a2=explode(' ',$e);
$tag=strtoupper(array_shift($a2));
$attr=array();
foreach($a2 as $v)
if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
$attr[strtoupper($a3[1])]=$a3[2];
$this->OpenTag($tag,$attr);
}
}
}
}
function OpenTag($tag,$attr)
{
//Opening tag
if($tag=='B' or $tag=='I' or $tag=='U')
$this->SetStyle($tag,true);
if($tag=='A')
$this->HREF=$attr['HREF'];
if($tag=='BR')
$this->Ln(5);
}
function CloseTag($tag)
{
//Closing tag
if($tag=='B' or $tag=='I' or $tag=='U')
$this->SetStyle($tag,false);
if($tag=='A')
$this->HREF='';
}
function SetStyle($tag,$enable)
{
//Modify style and select corresponding font
$this->$tag+=($enable ? 1 : -1);
$style='';
foreach(array('B','I','U') as $s)
if($this->$s>0)
$style.=$s;
$this->SetFont('',$style);
}
function PutLink($URL,$txt)
{
//Put a hyperlink
$this->SetTextColor(0,0,255);
$this->SetStyle('U',true);
$this->Write(5,$txt,$URL);
$this->SetStyle('U',false);
$this->SetTextColor(0);
}
}
if (isset($_REQUEST['navn'])) {
$navn = $_REQUEST["navn"];
$titel = $_REQUEST["titel"];
$skar = $_REQUEST["skar"];
$sql = "select * from XXXX WHERE YYYY like '$navn' limit 1";
$taeller_sql = "select count(*) as antal from XXXX";
//I DE NÆSTE TO LINIER ÅBNES DATABASE OG DATA HENTES(VED HJÆLP AF ET PAR FUNKTIONER, SOM IKKE ER BESKREVET HER)
aabn_forbindelse_og_vaelgdb();
$resultat = sql_spoerg_og_faa_svar($sql);
$optaelling = sql_spoerg_og_faa_svar($taeller_sql);
extract($optaelling[0]);
if(count($resultat) < 1) {
echo "Der er ingen dommere i databasen";
} else {
extract($resultat[0]);
}
$hoved='<B>DIVISIONSDOMMERFORENINGEN <I>DDF93</I></B>';
$Dommer= $Dommer . '';
if($titel == ""){
$titel = 'National Referee';
}else{
$titel = $titel . '';
}
$Gade = $Gade . '';
$Postby = $Postby . '';
$land = 'DK Denmark';
$Mail = 'Mail: ' . $Mail;
$link = '<I>
www.ddf93.dk</I>';$dvbf = 'Referee for DANISH VOLLEYBALL FEDERATION';
$dvbfadresse = 'Idraettens Hus Broendby Stadion 20 2605 Broendby';
$dvbfadresse1 = '
www.volleyball.dk';$pdf=new PDF();
$pdf->SetAuthor($navn1);
$pdf->SetTitle($title);
$pdf->SetCreator('Divisionsdommerforeningen - DDF93');
$pdf->AddPage();
$pdf->SetLineWidth(.1);
if($skar != ""){
$pdf->Line(5,0,5,5);
$pdf->Line(95,0,95,5);
$pdf->Line(100,0,100,5);
$pdf->Line(190,0,190,5);
}
$pdf->SetLink($link);
$hojde = 55;
for($i=0;$i<5;$i++) {
$dif = ($i*$hojde);
$dif1 = $dif +15;
$pdf->Image('
http://www.ddf93.dk/flute3.jpg',64,$dif1,25,0,'','
http://www.ddf93.dk');
$pdf->Image('
http://www.ddf93.dk/flute3.jpg',159,$dif1,25,0,'','
http://www.ddf93.dk');
$pdf->SetFont('Arial','',11);
$pdf->SetLineWidth(.2);
$pdf->SetDrawColor(0,0,255);
$dif2 = $dif + 44;
$pdf->Line(10,$dif2,90,$dif2);
$pdf->Line(105,$dif2,185,$dif2);
//Skæremærker
if($skar != ""){
$pdf->SetLineWidth(.1);
$dif3 = $dif + 6;
$pdf->Line(0,$dif3,5,$dif3);
$dif4 = $dif + 56;
$pdf->Line(0,$dif4,5,$dif4);
$pdf->Line(205,$dif3,210,$dif3);
$pdf->Line(205,$dif4,210,$dif4);
$pdf->Line(96,$dif3,99,$dif3);
$pdf->Line(96,$dif4,99,$dif4);
$dif6 = $dif + 57;
$dif7 = $dif + 60;
$pdf->Line(95,$dif6,95,$dif7);
$pdf->Line(100,$dif6,100,$dif7);
$pdf->Line(5,$dif6,5,$dif7);
$pdf->Line(190,$dif6,190,$dif7);
}
//Slut skæremærker
$pdf->SetLeftMargin(10);
$pdf->SetTextColor(0,0,255);
$dif8 = $dif + 10;
$pdf->SetY($dif8);
$pdf->WriteHTML($hoved);
$pdf->SetX(105);
$pdf->WriteHTML($hoved);
$pdf->Ln(5);
$pdf->SetFontSize(8);
$pdf->SetTextColor(0,0,0);
$pdf->WriteHTML($Dommer);
$pdf->SetX(105);
$pdf->WriteHTML($Dommer);
$pdf->Ln(3);
$pdf->WriteHTML($titel);
$pdf->SetX(105);
$pdf->WriteHTML($titel);
$pdf->Ln(3);
$pdf->WriteHTML($Gade);
$pdf->SetX(105);
$pdf->WriteHTML($Gade);
$pdf->Ln(3);
$pdf->WriteHTML($Postby);
$pdf->SetX(105);
$pdf->WriteHTML($Postby);
$pdf->Ln(3);
$pdf->WriteHTML($land);
$pdf->SetX(105);
$pdf->WriteHTML($land);
$pdf->Ln(3);
if($Telefon != ""){
$pdf->WriteHTML('Priv. tlf.');
$pdf->SetX(22);
$pdf->WriteHTML('+ 45 ');
$pdf->WriteHTML($Telefon);
$pdf->SetX(105);
$pdf->WriteHTML('Priv. tlf.');
$pdf->SetX(117);
$pdf->WriteHTML('+ 45 ');
$pdf->WriteHTML($Telefon);
}
$pdf->Ln(3);
if($Mobil != ""){
$pdf->WriteHTML('Mobil tlf.');
$pdf->SetX(22);
$pdf->WriteHTML('+ 45 ');
$pdf->WriteHTML($Mobil);
$pdf->SetX(105);
$pdf->WriteHTML('Mobil tlf.');
$pdf->SetX(117);
$pdf->WriteHTML('+ 45 ');
$pdf->WriteHTML($Mobil);
}
$pdf->Ln(3);
if($Telefonarb != ""){
$pdf->WriteHTML('Job tlf.');
$pdf->SetX(22);
$pdf->WriteHTML('+ 45 ');
$pdf->WriteHTML($Telefonarb);
$pdf->SetX(105);
$pdf->WriteHTML('Job tlf.');
$pdf->SetX(117);
$pdf->WriteHTML('+ 45 ');
$pdf->WriteHTML($Telefonarb);
}
$pdf->Ln(3);
$pdf->WriteHTML($Mail);
$pdf->SetX(67);
$pdf->SetTextColor(0,0,255);
$pdf->WriteHTML($link);
$pdf->SetX(105);
$pdf->SetTextColor(0,0,0);
$pdf->WriteHTML($Mail);
$pdf->SetX(162);
$pdf->SetTextColor(0,0,255);
$pdf->WriteHTML($link);
$pdf->Ln(5);
$pdf->SetTextColor(255,0,0);
$pdf->SetX(18);
$pdf->WriteHTML($dvbf);
$pdf->SetX(113);
$pdf->WriteHTML($dvbf);
$pdf->Ln(3);
$pdf->SetFontSize(7);
$pdf->SetTextColor(0,0,0);
$pdf->SetX(20);
$pdf->WriteHTML($dvbfadresse);
$pdf->SetX(115);
$pdf->WriteHTML($dvbfadresse);
$pdf->Ln(3);
$pdf->SetX(38);
$pdf->WriteHTML($dvbfadresse1);
$pdf->SetX(133);
$pdf->WriteHTML($dvbfadresse1);
}
$pdf->Output();