function OpenTag($tag, $attr) { //Opening tag switch ($tag) { case 'STRONG': $this->SetStyle('B', true); break; case 'EM': $this->SetStyle('I', true); break; case 'B': case 'I': case 'U': $this->SetStyle($tag, true); break; case 'A': $this->HREF = $attr['HREF']; break; case 'IMG': if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) { if (!isset($attr['WIDTH'])) { $attr['WIDTH'] = 0; } if (!isset($attr['HEIGHT'])) { $attr['HEIGHT'] = 0; } $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT'])); } break; case 'TR': case 'BLOCKQUOTE': case 'BR': $this->Ln(5); break; case 'P': $this->Ln(10); break; case 'FONT': if (isset($attr['COLOR']) && $attr['COLOR'] != '') { $coul = hex2dec($attr['COLOR']); $this->SetTextColor($coul['R'], $coul['V'], $coul['B']); $this->issetcolor = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) { $this->SetFont(strtolower($attr['FACE'])); $this->issetfont = true; } break; } }
function OpenTag($tag, $attr) { //Opening tag switch ($tag) { case 'SUP': if (!empty($attr['SUP'])) { //Set current font to 6pt $this->SetFont('', '', 6); //Start 125cm plus width of cell to the right of left margin //Superscript "1" $this->Cell(2, 2, $attr['SUP'], 0, 0, 'L'); } break; case 'TABLE': // TABLE-BEGIN if (!empty($attr['BORDER'])) { $this->tableborder = $attr['BORDER']; } else { $this->tableborder = 0; } break; case 'TR': //TR-BEGIN break; case 'TD': // TD-BEGIN if (!empty($attr['WIDTH'])) { $this->tdwidth = $attr['WIDTH'] / 4; } else { $this->tdwidth = 40; } // Set to your own width if you need bigger fixed cells if (!empty($attr['HEIGHT'])) { $this->tdheight = $attr['HEIGHT'] / 6; } else { $this->tdheight = 6; } // Set to your own height if you need bigger fixed cells if (!empty($attr['ALIGN'])) { $align = $attr['ALIGN']; if ($align == 'LEFT') { $this->tdalign = 'L'; } if ($align == 'CENTER') { $this->tdalign = 'C'; } if ($align == 'RIGHT') { $this->tdalign = 'R'; } } else { $this->tdalign = 'L'; } // Set to your own if (!empty($attr['BGCOLOR'])) { $coul = hex2dec($attr['BGCOLOR']); $this->SetFillColor($coul['R'], $coul['G'], $coul['B']); $this->tdbgcolor = true; } $this->tdbegin = true; break; case 'HR': if (!empty($attr['WIDTH'])) { $Width = $attr['WIDTH']; } else { $Width = $this->w - $this->lMargin - $this->rMargin; } $x = $this->GetX(); $y = $this->GetY(); $this->SetLineWidth(0.2); $this->Line($x, $y, $x + $Width, $y); $this->SetLineWidth(0.2); $this->Ln(1); break; case 'STRONG': $this->SetStyle('B', true); break; case 'EM': $this->SetStyle('I', true); break; case 'B': case 'I': case 'U': $this->SetStyle($tag, true); break; case 'A': $this->HREF = $attr['HREF']; break; case 'IMG': if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) { if (!isset($attr['WIDTH'])) { $attr['WIDTH'] = 0; } if (!isset($attr['HEIGHT'])) { $attr['HEIGHT'] = 0; } $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT'])); } break; case 'BLOCKQUOTE': case 'BR': $this->Ln(5); break; case 'P': $this->Ln(10); break; case 'FONT': if (isset($attr['COLOR']) && $attr['COLOR'] != '') { $coul = hex2dec($attr['COLOR']); $this->SetTextColor($coul['R'], $coul['G'], $coul['B']); $this->issetcolor = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) { $this->SetFont(strtolower($attr['FACE'])); $this->issetfont = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist) && isset($attr['SIZE']) && $attr['SIZE'] != '') { $this->SetFont(strtolower($attr['FACE']), '', $attr['SIZE']); $this->issetfont = true; } break; } }
function OpenTag($tag, $attr) { //Opening tag switch ($tag) { case 'STRONG': case 'B': if ($this->bi) { $this->SetStyle('B', true); } else { $this->SetStyle('U', true); } break; case 'H1': $this->Ln(5); $this->SetTextColor(150, 0, 0); $this->SetFontSize(22); break; case 'H2': $this->Ln(5); $this->SetFontSize(18); $this->SetStyle('U', true); break; case 'H3': $this->Ln(5); $this->SetFontSize(16); $this->SetStyle('U', true); break; case 'H4': $this->Ln(5); $this->SetTextColor(102, 0, 0); $this->SetFontSize(14); if ($this->bi) { $this->SetStyle('B', true); } break; case 'PRE': $this->SetFont('Courier', '', 11); $this->SetFontSize(11); $this->SetStyle('B', false); $this->SetStyle('I', false); $this->PRE = true; break; case 'RED': $this->SetTextColor(255, 0, 0); break; case 'BLOCKQUOTE': $this->mySetTextColor(100, 0, 45); $this->Ln(3); break; case 'BLUE': $this->SetTextColor(0, 0, 255); break; case 'I': case 'EM': if ($this->bi) { $this->SetStyle('I', true); } break; case 'U': $this->SetStyle('U', true); break; case 'A': $this->HREF = $attr['HREF']; break; case 'IMG': if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) { if (!isset($attr['WIDTH'])) { $attr['WIDTH'] = 0; } if (!isset($attr['HEIGHT'])) { $attr['HEIGHT'] = 0; } $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT'])); $this->Ln(3); } break; case 'LI': $this->Ln(2); $this->SetTextColor(190, 0, 0); $this->Write(5, ' » '); $this->mySetTextColor(-1); break; case 'TR': $this->Ln(7); $this->PutLine(); break; case 'BR': $this->Ln(4); break; case 'P': $this->Ln(10); $this->SetLeftMargin(60); break; case 'HR': $this->PutLine(); break; case 'FONT': if (isset($attr['COLOR']) && $attr['COLOR'] != '') { $coul = hex2dec($attr['COLOR']); $this->mySetTextColor($coul['R'], $coul['G'], $coul['B']); $this->issetcolor = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) { $this->SetFont(strtolower($attr['FACE'])); $this->issetfont = true; } break; } }
function OpenTag($tag, $attr) { // Opening tag switch ($tag) { case 'STRONG': $this->SetStyle('B', true); break; case 'EM': $this->SetStyle('I', true); break; case 'UL': break; case 'LI': $this->SetFont('Arial', '', 9); $this->Ln(1); $this->Write(4, "o "); $this->SetLeftMargin($this->lMargin + 5); break; case 'B': case 'I': case 'U': $this->SetStyle($tag, true); break; case 'A': $this->HREF = $attr['HREF']; break; case 'IMG': if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) { if (!isset($attr['WIDTH'])) { $attr['WIDTH'] = 0; } if (!isset($attr['HEIGHT'])) { $attr['HEIGHT'] = 0; } $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT'])); } break; case 'TR': case 'BLOCKQUOTE': case 'BR': $this->Ln(5); break; case 'H1': $this->Ln(5); $this->SetFont('Arial', 'B', 20); break; case 'H2': $this->Ln(5); $this->SetFont('Arial', 'B', 18); break; case 'H3': $this->Ln(5); $this->SetFont('Arial', 'B', 16); break; case 'H4': $this->Ln(5); $this->SetFont('Arial', 'B', 14); break; case 'H5': $this->Ln(5); $this->SetFont('Arial', 'B', 12); break; case 'H6': $this->Ln(5); $this->SetFont('Arial', 'B', 10); break; case 'H7': $this->Ln(5); $this->SetFont('Arial', 'B', 9); break; case 'P': $this->SetFont('Arial', '', 9); $this->Ln(3); break; case 'FONT': if (isset($attr['COLOR']) && $attr['COLOR'] != '') { $coul = hex2dec($attr['COLOR']); $this->SetTextColor($coul['R'], $coul['V'], $coul['B']); $this->issetcolor = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) { $this->SetFont(strtolower($attr['FACE'])); $this->issetfont = true; } break; } }
function PutImage($url, $scale) { if ($scale < 0) { $scale = 0; } //$scale<=0: put NO image inside the pdf! if ($scale > 0) { $xsflag = 0; $ysflag = 0; $yhflag = 0; $xscale = 1; $yscale = 1; //get image info $oposy = $this->GetY(); $url = str_replace(XOOPS_URL, XOOPS_ROOT_PATH, $url); $iminfo = @getimagesize($url); $iw = $scale * px2mm($iminfo[0]); $ih = $scale * px2mm($iminfo[1]); $iw = $iw ? $iw : 1; $ih = $ih ? $ih : 1; $nw = $iw; $nh = $ih; //resizing in x-direction $xsflag = 0; if ($iw > 150) { $xscale = 150 / $iw; $yscale = $xscale; $nw = $xscale * $iw; $nh = $xscale * $ih; $xsflag = 1; } //now eventually resizing in y-direction $ysflag = 0; if ($oposy + $nh > 250) { $yscale = (250 - $oposy) / $ih; $nw = $yscale * $iw; $nh = $yscale * $ih; $ysflag = 1; } //uups, if the scaling factor of resized image is < 0.33 //remark: without(!) the global factor $scale! //that's hard -> on the next page please... $yhflag = 0; if ($yscale < 0.33 and ($xsflag == 1 or $ysflag == 1)) { $nw = $xscale * $iw; $nh = $xscale * $ih; $ysflag == 0; $xsflag == 1; $yhflag = 1; } if ($yhflag == 1) { $this->AddPage(); } $oposy = $this->GetY(); $this->Image($url, $this->GetX(), $this->GetY(), $nw, $nh); $this->SetY($oposy + $nh); if ($yhflag == 0 and $ysflag == 1) { $this->AddPage(); } } }
function OpenTag($tag, $attr) { //Balise ouvrante switch ($tag) { case 'STRONG': $this->SetStyle('B', true); break; case 'EM': $this->SetStyle('I', true); break; case 'B': case 'I': case 'U': $this->SetStyle($tag, true); break; case 'A': $this->HREF = $attr['HREF']; break; case 'IMG': if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) { if (!isset($attr['WIDTH'])) { $attr['WIDTH'] = 0; } if (!isset($attr['HEIGHT'])) { $attr['HEIGHT'] = 0; } $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT'])); } break; case 'TH': $this->TH = 'TH'; // $this->lMargin += 5; // $this->SetXY(5, $this->tMargin); break; // $this->Cell(50,6,$e,1,1,'L'); // break; // $this->Cell(50,6,$e,1,1,'L'); // break; case 'TD': $this->TD = 'TD'; break; case 'TR': // $y = $this->getY(); // $this->setY($y+5); // $this->setX(10); $this->Ln(5); // $this->SetXY($this->lMargin, $this->tMargin); break; case 'BLOCKQUOTE': case 'BR': $this->Ln(5); break; case 'P': $this->Ln(10); break; case 'FONT': if (isset($attr['COLOR']) && $attr['COLOR'] != '') { $coul = hex2dec($attr['COLOR']); $this->SetTextColor($coul['R'], $coul['V'], $coul['B']); $this->issetcolor = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) { $this->SetFont(strtolower($attr['FACE'])); $this->issetfont = true; } break; } }
function OpenTag($tag, $attr) { //Opening tag switch ($tag) { case 'STRONG': $this->SetStyle('B', true); break; case 'EM': $this->SetStyle('I', true); break; case 'B': case 'I': case 'U': $this->SetStyle($tag, true); break; case 'A': $this->HREF = $attr['HREF']; break; case 'IMG': if (isset($attr['SRC']) and (isset($attr['WIDTH']) or isset($attr['HEIGHT']))) { if (!isset($attr['WIDTH'])) { $attr['WIDTH'] = 0; } if (!isset($attr['HEIGHT'])) { $attr['HEIGHT'] = 0; } $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT'])); } break; case 'TR': case 'BLOCKQUOTE': case 'BR': $this->Ln(5); break; case 'P': $this->Ln(10); break; case 'FONT': if (isset($attr['COLOR']) and $attr['COLOR'] != '') { $coul = hex2dec($attr['COLOR']); $this->SetTextColor($coul['R'], $coul['G'], $coul['B']); $this->issetcolor = true; } if (isset($attr['FACE']) and in_array(strtolower($attr['FACE']), $this->fontlist)) { $this->SetFont(strtolower($attr['FACE'])); $this->issetfont = true; } break; case 'HR': if (isset($attr['WIDTH']) && $attr['WIDTH'] != '') { $Width = $attr['WIDTH']; } else { $Width = $this->w - $this->lMargin - $this->rMargin; } $x = $this->GetX(); $y = $this->GetY(); $this->SetDrawColor(200, 200, 200); $this->SetLineWidth(0.5); $this->Line($x + 5, $y + 5, $x + $Width, $y + 5); $this->SetDrawColor(0, 0, 0); $this->Ln(8); break; case 'H2': $this->SetFont('Arial', 'B', 18); break; } }
/** * OpenTag * öffnet einen HTML Tag in der PDF Klasse * @param string $tag * @param array $attr */ function OpenTag($tag, $attr) { //Start Tag //diverse Anpassungen an Kunden Bedürfnisse switch ($tag) { case 'SUP': if (!empty($attr['SUP'])) { //Set current font to 6pt $this->SetFont('', '', 6); //Start 125cm plus width of cell to the right of left margin //Superscript "1" $this->Cell(2, 2, $attr['SUP'], 0, 0, 'L'); } break; case 'TABLE': // TABLE-BEGIN $this->iTAB++; $this->iTR = 0; if (!empty($attr['BORDER'])) { $this->tableborder = $attr['BORDER']; } else { $this->tableborder = 'B'; } break; case 'TR': //TR-BEGIN $this->iTR++; $this->iTD = 0; break; case 'TH': case 'TD': // TD-BEGIN $this->iTD++; /*if( !empty($attr['WIDTH']) ) $this->tdwidth=($attr['WIDTH']/4); else $this->setTDdim( 'WIDTH' ); if( !empty($attr['HEIGHT']) ) $this->tdheight=($attr['HEIGHT']/6); else $this->setTDdim( 'HEIGHT' );*/ $this->setTDdim('WIDTH'); $this->setTDdim('HEIGHT'); if (!empty($attr['ALIGN'])) { $align = $attr['ALIGN']; if ($align == 'LEFT') { $this->tdalign = 'L'; } if ($align == 'CENTER') { $this->tdalign = 'C'; } if ($align == 'RIGHT') { $this->tdalign = 'R'; } } else { $this->tdalign = 'L'; } // Set to your own if (!empty($attr['BGCOLOR'])) { $coul = hex2dec($attr['BGCOLOR']); $this->SetFillColor($coul['R'], $coul['G'], $coul['B']); $this->tdbgcolor = true; } $this->tdbegin = true; break; case 'HR': if (!empty($attr['WIDTH'])) { //$axt=1; $Width = $attr['WIDTH']; } else { $Width = $this->w - $this->lMargin - $this->rMargin; } $x = $this->GetX(); $y = $this->GetY(); $this->SetLineWidth(0.2); $this->Line($x, $y, $x + $Width, $y); $this->SetLineWidth(0.2); $this->Ln(1); break; case 'STRONG': $this->SetStyle('B', true); break; case 'EM': $this->SetStyle('I', true); break; case 'B': case 'I': case 'U': $this->SetStyle($tag, true); break; case 'A': $this->HREF = $attr['HREF']; break; case 'IMG': if (isset($attr['SRC'])) { if (!isset($attr['WIDTH'])) { if ($this->firstPic == 1) { $attr['WIDTH'] = 540; $this->firstPic = 0; } else { $attr['WIDTH'] = 0; } } if (!isset($attr['HEIGHT'])) { $attr['HEIGHT'] = 0; } $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT'])); } break; case 'BLOCKQUOTE': case 'BR': $this->Ln(5); break; case 'P': $this->Ln(10); break; case 'FONT': if (isset($attr['COLOR']) && $attr['COLOR'] != '') { $coul = hex2dec($attr['COLOR']); $this->SetTextColor($coul['R'], $coul['G'], $coul['B']); $this->issetcolor = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) { $this->SetFont(strtolower($attr['FACE'])); $this->issetfont = true; } if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist) && isset($attr['SIZE']) && $attr['SIZE'] != '') { $this->SetFont(strtolower($attr['FACE']), '', $attr['SIZE']); $this->issetfont = true; } break; } }