FPDF($orientation,$unit,$size); // 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(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3)) $attr[strtoupper($a3[1])] = $a3[2]; } $this->OpenTag($tag,$attr); } } } } function OpenTag($tag, $attr) { // Opening tag if($tag=='B' || $tag=='I' || $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' || $tag=='I' || $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); } function SetTitle($title) { // Arial bold 15 $this->SetFont('Arial','B',15); // Calculate width of title and position $w = $this->GetStringWidth($title); $this->SetX((8.5-$w)/2); // Colors of frame, background and text $this->SetDrawColor(23,162,220); $this->SetFillColor(255,255,255); $this->SetTextColor(0,82,155); // Thickness of frame (1 mm) $this->SetLineWidth(.025); // Title $this->Cell($w,5,$title,1,1,'C',true); // Line break $this->Ln(10); } } class PDF_TextBox extends FPDF { /** * Draws text within a box defined by width = w, height = h, and aligns * the text vertically within the box ($valign = M/B/T for middle, bottom, or top) * Also, aligns the text horizontally ($align = L/C/R/J for left, centered, right or justified) * drawTextBox uses drawRows * * This function is provided by TUFaT.com */ function drawTextBox($strText, $w, $h, $align='L', $valign='T', $border=true) { $xi=$this->GetX(); $yi=$this->GetY(); $hrow=$this->FontSize; $textrows=$this->drawRows($w,$hrow,$strText,0,$align,0,0,0); $maxrows=floor($h/$this->FontSize); $rows=min($textrows,$maxrows); $dy=0; if (strtoupper($valign)=='M') $dy=($h-$rows*$this->FontSize)/2; if (strtoupper($valign)=='B') $dy=$h-$rows*$this->FontSize; $this->SetY($yi+$dy); $this->SetX($xi); $this->drawRows($w,$hrow,$strText,0,$align,false,$rows,1); if ($border) $this->Rect($xi,$yi,$w,$h); } function drawRows($w, $h, $txt, $border=0, $align='J', $fill=false, $maxline=0, $prn=0) { $cw=&$this->CurrentFont['cw']; if($w==0) $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $s=str_replace("\r",'',$txt); $nb=strlen($s); if($nb>0 && $s[$nb-1]=="\n") $nb--; $b=0; if($border) { if($border==1) { $border='LTRB'; $b='LRT'; $b2='LR'; } else { $b2=''; if(is_int(strpos($border,'L'))) $b2.='L'; if(is_int(strpos($border,'R'))) $b2.='R'; $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2; } } $sep=-1; $i=0; $j=0; $l=0; $ns=0; $nl=1; while($i<$nb) { //Get next character $c=$s[$i]; if($c=="\n") { //Explicit line break if($this->ws>0) { $this->ws=0; if ($prn==1) $this->_out('0 Tw'); } if ($prn==1) { $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); } $i++; $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; if ( $maxline && $nl > $maxline ) return substr($s,$i); continue; } if($c==' ') { $sep=$i; $ls=$l; $ns++; } $l+=$cw[$c]; if($l>$wmax) { //Automatic line break if($sep==-1) { if($i==$j) $i++; if($this->ws>0) { $this->ws=0; if ($prn==1) $this->_out('0 Tw'); } if ($prn==1) { $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); } } else { if($align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; if ($prn==1) $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); } if ($prn==1){ $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); } $i=$sep+1; } $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; if ( $maxline && $nl > $maxline ) return substr($s,$i); } else $i++; } //Last chunk if($this->ws>0) { $this->ws=0; if ($prn==1) $this->_out('0 Tw'); } if($border && is_int(strpos($border,'B'))) $b.='B'; if ($prn==1) { $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); } $this->x=$this->lMargin; return $nl; } } $fullname=$_GET["n"]; $company=$_GET["c"]; $customer=$_GET["x"]; //$fullname='dylan wood'; //$company ='berlin productions'; //$string=$fullname.$this->Ln(.5).$company; // TAG SIZE IS 3.875 x 2.75 $pdf=new PDF_TextBox('p','in','letter'); //$pdf = new PDF('p','in','letter'); $pdf->AddPage(); $pdf->Image('gcshowAtConfEml.gif',0.8,0.2,0,0,''); $pdf->Image('cuticon.jpg',2.95,3.0,3.60,0.609,''); //$pdf->SetLink($link); $pdf->Image('showcase_h.jpg',2.45,3.6,3.60,0.609,''); if($customer!=''){ $pdf->Image('bbcustomer.jpg',2.45,5.9,3.60,0.26,''); } $pdf->SetLeftMargin(33); $pdf->SetFont('Arial','B',13); $pdf->text(.5, 1.8, 'Thank you for registering for The Blue Book Network\'s upcoming educational'); $pdf->text(.5, 2, 'and networking event. We are confident that this will be a valuable few '); $pdf->text(.5, 2.2, 'hours for your company.'); $pdf->text(.5, 2.6, 'Please print this page and cut out your personalized name badge. Make sure'); $pdf->text(.5, 2.8, 'to bring it with you to simplify registration at the event. '); //doc.rect(1.7, 3.6, 5, 3); // empty square //$pdf->SetTitle($fullname); //$pdf->AddPage(); $pdf->SetTextColor(0,81,154); $pdf->SetFont('Arial','B',20); $mid_x = 4.25; $pdf->Text($mid_x - ($pdf->GetStringWidth($fullname) / 2), 4.95, $fullname); $pdf->SetFont('Arial','',16); $pdf->SetXY(2.3125,3.5); $pdf->drawTextBox(' '.$company.'', 3.875, 2.75, 'C', 'M'); //$pdf->SetFont('Arial','B',26); //$pdf->text(2.5, 5.8, $fullname); //$pdf->SetFont('Arial','B',22); //$pdf->text(2.5, 6.2, $company); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',12); $pdf->text(.5, 7.3, 'We encourage you to arrive on time to ensure that you get the most out of this unique opportunity. '); $pdf->text(.5, 7.5, 'If you have any questions or concerns about your registration, or the event itself, please feel free'); $pdf->text(.5, 7.7, 'to contact The Blue Book Network Event Registration Department at 1-800-431-2584 or call your'); $pdf->text(.5, 7.9, 'local Blue Book Account Manager.'); $pdf->text(.5, 8.3, 'All of us at The Blue Book Building and Construction Network look forward to welcoming you.'); $pdf->SetFontSize(14); $pdf->Output(); ?>