public function ellipse(\PhpSigep\Pdf\ImprovedFPDF $pdf, $x, $y, $rx, $ry, $style = 'D') { if ($style == 'F') { $op = 'f'; } elseif ($style == 'FD' or $style == 'DF') { $op = 'B'; } else { $op = 'S'; } $x += $rx; $y += $ry; $lx = 4 / 3 * (M_SQRT2 - 1) * $rx; $ly = 4 / 3 * (M_SQRT2 - 1) * $ry; $k = $pdf->k; $h = $pdf->h; $pdf->_out(sprintf('%.2f %.2f m %.2f %.2f %.2f %.2f %.2f %.2f c', ($x + $rx) * $k, ($h - $y) * $k, ($x + $rx) * $k, ($h - ($y - $ly)) * $k, ($x + $lx) * $k, ($h - ($y - $ry)) * $k, $x * $k, ($h - ($y - $ry)) * $k)); $pdf->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c', ($x - $lx) * $k, ($h - ($y - $ry)) * $k, ($x - $rx) * $k, ($h - ($y - $ly)) * $k, ($x - $rx) * $k, ($h - $y) * $k)); $pdf->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c', ($x - $rx) * $k, ($h - ($y + $ly)) * $k, ($x - $lx) * $k, ($h - ($y + $ry)) * $k, $x * $k, ($h - ($y + $ry)) * $k)); $pdf->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c %s', ($x + $lx) * $k, ($h - ($y + $ry)) * $k, ($x + $rx) * $k, ($h - ($y + $ly)) * $k, ($x + $rx) * $k, ($h - $y) * $k, $op)); }
public function draw(\PhpSigep\Pdf\ImprovedFPDF $pdf) { $pdf->saveState(); // quantos mm cabem dentro de um pt do pdf $un = 72 / 25.4; // Desenha o elipse $k = $pdf->k; $wRect = $un * 30 / $k; $h = $un * 28 / $k; $lineWidth = 2 / $k; $pdf->SetLineWidth($lineWidth); $x = $this->x; $y = $this->y; $rx = $wRect / 2; $ry = $h / 2; $elipse = new Elipse(); $pdf->SetDrawColor(0, 0, 0); $elipse->ellipse($pdf, $x, $y, $rx, $ry); // Escreve o texto $pdf->SetFont('Arial', 'BI'); $pdf->SetXY($x, $y + 10 / $k); $fontSize = 15; $texto = 'Carta'; $pdf->SetFontSize($fontSize); $pdf->Cell($wRect, 23 / $k, $texto, 0, 2, 'C'); // Número contrato e DR $pdf->SetFont('', '', 7); $texto = $this->accessData->getNumeroContrato() . '/' . $this->accessData->getAnoContrato() . '-DR/' . $this->accessData->getDiretoria()->getSigla(); $pdf->Cell($wRect, 6 / $k, $texto, 0, 2, 'C'); // Nome do remetente $pdf->SetFont('', 'B', 9); $pdf->MultiCell($wRect, 9 / $k, $pdf->_($this->nomeRemetente), 0, 'C'); // Insere a logo do correios na parte inferior $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(15 / $k); $x1 = $x + 24.5 / $k; $x2 = $x1 + $pdf->GetStringWidth('CORREIOS') - 9.5 / $k; $y1 = $y + $h - 6 / $k; $pdf->Image(realpath(dirname(__FILE__)) . '/../correios-logo.png', $x1 - 2, $y1 - 5); $pdf->restoreLastState(); }
private function addPage() { $pdf = $this->pdf; $pdf->AddPage(); if (Bootstrap::getConfig()->getSimular()) { $this->pdf->SetFont('Arial', 'B', 50); $this->pdf->SetTextColor(200, 200, 200); $hInner = $pdf->h - $pdf->tMargin - $pdf->bMargin; $lineHeigth = $pdf->getLineHeigth(); $pdf->SetY($hInner / 2 - $lineHeigth / 2); $this->pdf->MultiCellXp($this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin, "Simulação Documento sem valor", null, 0, 'C'); $this->pdf->SetTextColor(0, 0, 0); } $pdf->x = $pdf->lMargin; $pdf->y = $pdf->tMargin; }
private function t($w, $txt, $ln, $align, $h = null, $multiLines = false, $utf8 = true) { if ($utf8) { $txt = $this->_($txt); } // $border = 1; // $fill = true; $border = 0; $fill = false; if ($h === null) { $h = $this->pdf->getLineHeigth(); } if ($multiLines) { $this->pdf->MultiCell($w, $h, $txt, $border, $align, $fill); } else { $this->pdf->Cell($w, $h, $txt, $border, $ln, $align, $fill); } }
public function StopTransform(\PhpSigep\Pdf\ImprovedFPDF $pdf) { //restore previous graphic state $pdf->_out('Q'); }
public function draw(\PhpSigep\Pdf\ImprovedFPDF $pdf) { $pdf->saveState(); // quantos mm cabem dentro de um pt do pdf $un = 72 / 25.4; // Desenha o elipse $k = $pdf->k; $wRect = $un * 30 / $k; $h = $un * 28 / $k; $lineWidth = 2 / $k; $pdf->SetLineWidth($lineWidth); $x = $this->x; $y = $this->y; $rx = $wRect / 2; $ry = $h / 2; $elipse = new Elipse(); $pdf->SetDrawColor(0, 0, 0); $elipse->ellipse($pdf, $x, $y, $rx, $ry); // Escreve o texto $pdf->SetFont('Arial', 'BI'); $pdf->SetXY($x, $y + 10 / $k); $fontSize = 15; $texto = 'Carta'; $pdf->SetFontSize($fontSize); $pdf->Cell($wRect, 23 / $k, $texto, 0, 2, 'C'); //Faz os dois riscos brancos da parte inferior - lado esquerdo $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(3 / $k); $x1 = $x + 11 / $k; $x2 = $x1 - 1 / $k; $y1 = $y + $h - 15.5 / $k; $y2 = $y1 + 1 / $k; $pdf->Line($x1, $y1, $x2, $y2); $space = 3.5 / $k; $x1 += $space; $x2 = $x1 - 1 / $k; $y1 += $space; $y2 = $y1 + 1 / $k; $pdf->Line($x1, $y1, $x2, $y2); $x1 = $x + 19.3 / $k; $x2 = $x1 - 0.85 / $k; $y1 = $y + 57.26 / $k; $y2 = $y1 + 0.85 / $k; $pdf->Line($x1, $y1, $x2, $y2); //Faz os dois riscos brancos da parte inferior - lado direito $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(3 / $k); $x1 = $x + $wRect - 7.5 / $k; $x2 = $x1 + 1 / $k; $y1 = $y + $h - 17.5 / $k; $y2 = $y1 + 1 / $k; $pdf->Line($x1, $y1, $x2, $y2); $space = 3.5 / $k; $x1 += $space - 7.6 / $k; $x2 = $x1 + 1 / $k; $y1 += $space - 0.4 / $k; $y2 = $y1 + 1 / $k; $pdf->Line($x1, $y1, $x2, $y2); $x1 = $x1 - 4 / $k; $x2 = $x1 + 0.85 / $k; $y1 = $y + 58.26 / $k; $y2 = $y1 + 0.85 / $k; $pdf->Line($x1, $y1, $x2, $y2); // Número contrato e DR $pdf->SetFont('', '', 7); $texto = $this->accessData->getNumeroContrato() . '/' . $this->accessData->getAnoContrato() . '-DR/' . $this->accessData->getSigla(); $pdf->Cell($wRect, 7 / $k, $texto, 0, 2, 'C'); // Nome do remetente $pdf->SetFont('', 'B', 9); $pdf->MultiCell($wRect, 9 / $k, $pdf->_($this->nomeRemetente), 0, 'C'); // Escreve CORREIOS na parte inferior $text = 'CORREIOS'; $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(15 / $k); $x1 = $x + 24.5 / $k; $x2 = $x1 + $pdf->GetStringWidth($text) - 9.5 / $k; $y1 = $y + $h - 6 / $k; $pdf->Line($x1, $y1, $x2, $y1); $pdf->SetFontSize(9); $circularText = new CircularText(); $circularText->CircularText($pdf, $x + $wRect / 2 + 1, $y + 7 / $k, 75, $text, 'bottom'); $pdf->restoreLastState(); }
public function draw(\PhpSigep\Pdf\ImprovedFPDF $pdf) { $pdf->saveState(); // quantos mm cabem dentro de um pt do pdf $un = 72 / 25.4; // Desenha o elipse $k = $pdf->k; $wRect = $un * 31.5 / $k; $h = $un * 20.7 / $k; $lineWidth = 2 / $k; $pdf->SetLineWidth($lineWidth); $x = $this->x; $y = $this->y; $rx = $wRect / 2; $ry = $h / 2; $elipse = new Elipse(); $pdf->SetDrawColor(0, 0, 0); $elipse->ellipse($pdf, $x, $y, $rx, $ry); // Escreve o texto PAC $pdf->SetFont('Arial', 'BI'); $pdf->SetXY($x, $y + 5 / $k); $fontSize = 12; if ($this->tipoServico == self::SERVICE_E_SEDEX) { $texto = 'e-SEDEX'; } else { if ($this->tipoServico == self::SERVICE_SEDEX) { $texto = 'SEDEX'; } else { if ($this->tipoServico == self::SERVICE_SEDEX_10) { $fontSize = 11; $texto = 'SEDEX 10'; } else { if ($this->tipoServico == self::SERVICE_SEDEX_12) { $fontSize = 11; $texto = 'SEDEX 12'; } else { if ($this->tipoServico == self::SERVICE_SEDEX_HOJE) { $fontSize = 11; $texto = 'SEDEX Hoje'; } } } } } $pdf->SetFontSize($fontSize); $pdf->Cell($wRect, 18 / $k, $texto, 0, 2, 'C'); //Faz os dois riscos brancos da parte superior $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(4 / $k); $x1 = $x + 9.9 / $k; $x2 = $x1 + 3.96 / $k; $y1 = $y + 10.8 / $k; $y2 = $y1 - 2.7 / $k; $pdf->Line($x1, $y1, $x2, $y2); $x1 = $x + $wRect - 9.9 / $k; $x2 = $x1 - 3.96 / $k; $pdf->Line($x1, $y1, $x2, $y2); //Faz os dois riscos brancos da parte inferior - lado esquerdo $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(2.7 / $k); $x1 = $x + 9.9 / $k; $x2 = $x1 - 0.99 / $k; $y1 = $y + $h - 12.15 / $k; $y2 = $y1 + 0.99 / $k; $pdf->Line($x1, $y1, $x2, $y2); $space = 2.835 / $k; $x1 += $space; $x2 = $x1 - 0.99 / $k; $y1 += $space; $y2 = $y1 + 0.99 / $k; $pdf->Line($x1, $y1, $x2, $y2); $x1 = $x + 17.37 / $k; $x2 = $x1 - 0.765 / $k; $y1 = $y + 51.534 / $k; $y2 = $y1 + 0.765 / $k; $pdf->Line($x1, $y1, $x2, $y2); //Faz os dois riscos brancos da parte inferior - lado direito $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(2.7 / $k); $x1 = $x + $wRect - 9.9 / $k; $x2 = $x1 + 0.99 / $k; $y1 = $y + $h - 12.15 / $k; $y2 = $y1 + 0.99 / $k; $pdf->Line($x1, $y1, $x2, $y2); $space = 2.835 / $k; $x1 += $space - 6.84 / $k; $x2 = $x1 + 0.99 / $k; $y1 += $space - 0.36 / $k; $y2 = $y1 + 0.99 / $k; $pdf->Line($x1, $y1, $x2, $y2); $x1 = $x1 - 3.6 / $k; $x2 = $x1 + 0.765 / $k; $y1 = $y + 52.434 / $k; $y2 = $y1 + 0.765 / $k; $pdf->Line($x1, $y1, $x2, $y2); // Número contrato e DR $pdf->SetFont('', '', 6); $texto = $this->accessData->getNumeroContrato() . '/' . $this->accessData->getAnoContrato() . '-DR/' . $this->accessData->getDiretoria()->getSigla(); $pdf->Cell($wRect, 6 / $k, $texto, 0, 2, 'C'); // Nome do remetente $pdf->SetFont('', 'B', 8); $pdf->MultiCell($wRect, 8 / $k, $pdf->_($this->nomeRemetente), 0, 'C'); // Escreve CORREIOS na parte inferior $text = 'CORREIOS'; $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(10 / $k); $x1 = $x + 23.6 / $k; $x2 = $x1 + $pdf->GetStringWidth($text) - 1 / $k; $y1 = $y + $h - 3.8 / $k; $pdf->Line($x1, $y1, $x2, $y1); $pdf->SetFontSize(8); $circularText = new CircularText(); $circularText->CircularText($pdf, $x + $wRect / 2, -144 / $k, 75, $text, 'bottom'); $pdf->restoreLastState(); }
public function draw(\PhpSigep\Pdf\ImprovedFPDF $pdf, $x, $y, $code, $w, $h) { $Aguid = ""; // Cr�ation des guides de choix ABC $Bguid = ""; $Cguid = ""; for ($i = 0; $i < strlen($code); $i++) { $needle = substr($code, $i, 1); $Aguid .= strpos($this->Aset, $needle) === false ? "N" : "O"; $Bguid .= strpos($this->Bset, $needle) === false ? "N" : "O"; $Cguid .= strpos($this->Cset, $needle) === false ? "N" : "O"; } $SminiC = "OOOO"; $IminiC = 4; $crypt = ""; while ($code > "") { // BOUCLE PRINCIPALE DE CODAGE $i = strpos($Cguid, $SminiC); // for�age du jeu C, si possible if ($i !== false) { $Aguid[$i] = "N"; $Bguid[$i] = "N"; } if (substr($Cguid, 0, $IminiC) == $SminiC) { // jeu C $crypt .= chr($crypt > "" ? $this->JSwap["C"] : $this->JStart["C"]); // d�but Cstart, sinon Cswap $made = strpos($Cguid, "N"); // �tendu du set C if ($made === false) { $made = strlen($Cguid); } if (fmod($made, 2) == 1) { $made--; // seulement un nombre pair } for ($i = 0; $i < $made; $i += 2) { $crypt .= chr(strval(substr($code, $i, 2))); // conversion 2 par 2 } $jeu = "C"; } else { $madeA = strpos($Aguid, "N"); // �tendu du set A if ($madeA === false) { $madeA = strlen($Aguid); } $madeB = strpos($Bguid, "N"); // �tendu du set B if ($madeB === false) { $madeB = strlen($Bguid); } $made = $madeA < $madeB ? $madeB : $madeA; // �tendu trait�e $jeu = $madeA < $madeB ? "B" : "A"; // Jeu en cours $crypt .= chr($crypt > "" ? $this->JSwap[$jeu] : $this->JStart[$jeu]); // d�but start, sinon swap $crypt .= strtr(substr($code, 0, $made), $this->SetFrom[$jeu], $this->SetTo[$jeu]); // conversion selon jeu } $code = substr($code, $made); // raccourcir l�gende et guides de la zone trait�e $Aguid = substr($Aguid, $made); $Bguid = substr($Bguid, $made); $Cguid = substr($Cguid, $made); } // FIN BOUCLE PRINCIPALE $check = ord($crypt[0]); // calcul de la somme de contr�le for ($i = 0; $i < strlen($crypt); $i++) { $check += ord($crypt[$i]) * $i; } $check %= 103; $crypt .= chr($check) . chr(106) . chr(107); // Chaine Crypt�e compl�te $i = strlen($crypt) * 11 - 8; // calcul de la largeur du module $modul = $w / $i; for ($i = 0; $i < strlen($crypt); $i++) { // BOUCLE D'IMPRESSION $c = $this->T128[ord($crypt[$i])]; for ($j = 0; $j < count($c); $j++) { $pdf->Rect($x, $y, $c[$j] * $modul, $h, "F"); $x += ($c[$j++] + $c[$j]) * $modul; } } }
private function labeledText(ImprovedFPDF $pdf, $label, $text, $maxW, $ln = 0, $multLines = false) { $pdf->saveState(); $pdf->SetFont('', ''); $wLabel = $pdf->GetStringWidthXd($label . ' '); $pdf->SetFont('', 'B'); $xLabel = $pdf->x; $pdf->CellXp($wLabel, $label); $pdf->SetFont('', ''); $maxTextW = $maxW - $wLabel; if ($multLines) { if (is_float($multLines) || is_int($multLines)) { $pdf->setLineHeightPadding($multLines); } $x = $pdf->x - $wLabel; $pdf->MultiCellXp($maxTextW, $text); if ($ln === 0) { $pdf->SetX($x + $maxTextW); } else { if ($ln == 1) { $pdf->SetX($pdf->lMargin); } else { if ($ln == 2) { $pdf->SetX($x); } } } } else { while ($text && $maxTextW < $pdf->GetStringWidth($text)) { $text = substr($text, 0, strlen($text) - 1); } $pdf->CellXp($maxTextW, $text, '', $ln); if ($ln == 2) { $pdf->x -= $wLabel; } } $lastX = $pdf->x; $lastY = $pdf->y; $pdf->restoreLastState(); if ($ln === 0) { $pdf->SetX($xLabel + $maxW); } else { if ($ln === 1) { $pdf->SetXY($lastX, $lastY); } else { if ($ln === 2) { $pdf->SetXY($lastX, $lastY); } } } }
public function draw(\PhpSigep\Pdf\ImprovedFPDF $pdf) { $pdf->saveState(); // quantos mm cabem dentro de um pt do pdf $un = 72 / 25.4; // Desenha o retangulo $pdf->SetFillColor(0, 0, 0); $pdf->SetDrawColor(0, 0, 0); $k = $pdf->k; $wRect = $un * 31.5 / $k; $h = $un * 22.5 / $k; $lineWidth = 2 / $k; $pdf->SetLineWidth($lineWidth); $x = $this->x; $y = $this->y; $pdf->RoundedRect($x, $y, $wRect, $h, 5); // Escreve o texto PAC $pdf->SetFont('Arial', 'B', 27); $pdf->SetXY($x, $y + 4.5 / $k); $pdf->Cell($wRect, 27 / $k, 'PAC', 0, 2, 'C'); // Número contrato e DR $pdf->SetFont('', '', 7); $texto = $this->accessData->getNumeroContrato() . '/' . $this->accessData->getAnoContrato() . '-DR/' . $this->accessData->getDiretoria()->getSigla(); $pdf->Cell($wRect, 6 / $k, $texto, 0, 2, 'C'); // Nome do remetente $pdf->SetFont('', 'B', 9); $pdf->MultiCell($wRect, 8 / $k, $pdf->_($this->nomeRemetente), 0, 'C'); // Insere a logo do correios na parte inferior $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(2 / $k); $x1 = $x + 3.15 * $un / $k; $x2 = $x1 + 0.54 / $k; $y1 = $y + $h + 0.45 / $k; $y2 = $y1 - 0.9 / $k; $space = 3.6 / $k; $x1 += $space; $x2 += $space; $x1 += $space; $x2 += $space; $x1 += $space; $pdf->SetFontSize(9); $stringWidth = $pdf->GetStringWidth('CORREIOS'); $x2 += $space + $stringWidth; $pdf->SetLineWidth(2.5 / $k); $pdf->Line($x1, $y + $h, $x2, $y + $h); $pdf->Image(realpath(dirname(__FILE__)) . '/../correios-logo.png', $x1, $y1 - 3); $pdf->restoreLastState(); }
public function draw(\PhpSigep\Pdf\ImprovedFPDF $pdf) { $pdf->saveState(); // quantos mm cabem dentro de um pt do pdf $un = 72 / 25.4; // Desenha o retangulo $pdf->SetFillColor(0, 0, 0); $pdf->SetDrawColor(0, 0, 0); $k = $pdf->k; $wRect = $un * 35 / $k; $h = $un * 25 / $k; $lineWidth = 2 / $k; $pdf->SetLineWidth($lineWidth); $x = $this->x; $y = $this->y; $pdf->Rect($x, $y, $wRect, $h); // Escreve o texto PAC $pdf->SetFont('Arial', 'B', 30); $pdf->SetXY($x, $y + 5 / $k); $pdf->Cell($wRect, 30 / $k, 'PAC', 0, 2, 'C'); // Número contrato e DR $pdf->SetFont('', '', 7); $texto = $this->accessData->getNumeroContrato() . '/' . $this->accessData->getAnoContrato() . '-DR/' . $this->accessData->getSigla(); $pdf->Cell($wRect, 7 / $k, $texto, 0, 2, 'C'); // Nome do remetente $pdf->SetFont('', 'B', 9); $pdf->MultiCell($wRect, 9 / $k, $pdf->_($this->nomeRemetente), 0, 'C'); // Escreve o texto CORREIOS $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(2 / $k); $x1 = $x + 3.5 * $un / $k; $x2 = $x1 + 0.6 / $k; $y1 = $y + $h + 0.5 / $k; $y2 = $y1 - 1 / $k; $space = 4 / $k; $pdf->Line($x1, $y1, $x2, $y2); $x1 += $space; $x2 += $space; $pdf->Line($x1, $y1, $x2, $y2); $x1 += $space; $x2 += $space; $pdf->Line($x1, $y1, $x2, $y2); $texto = 'CORREIOS'; $x1 += $space; $pdf->SetFontSize(10); $stringWidth = $pdf->GetStringWidth($texto); $x2 += $space + $stringWidth; $pdf->SetLineWidth(2.5 / $k); $pdf->Line($x1, $y + $h, $x2, $y + $h); $pdf->Text($x1, $y1, $texto); // $pdf->Cell($stringWidth, 10/$k, $texto, 0); $x1 += $space + $pdf->GetStringWidth($texto); $x2 += $space; $pdf->Line($x1, $y1, $x2, $y2); $x1 += $space; $x2 += $space; $pdf->Line($x1, $y1, $x2, $y2); $x1 += $space; $x2 += $space; $pdf->Line($x1, $y1, $x2, $y2); $pdf->restoreLastState(); }
public function CircularText(\PhpSigep\Pdf\ImprovedFPDF $pdf, $x, $y, $r, $text, $align = 'top', $kerning = 120, $fontwidth = 100) { $transf = new Transform(); $kerning /= 100; $fontwidth /= 100; if ($kerning == 0) { $pdf->Error('Please use values unequal to zero for kerning'); } if ($fontwidth == 0) { $pdf->Error('Please use values unequal to zero for font width'); } //get width of every letter $t = 0; for ($i = 0; $i < strlen($text); $i++) { $w[$i] = $pdf->GetStringWidth($text[$i]); $w[$i] *= $kerning * $fontwidth; //total width of string $t += $w[$i]; } //circumference $u = $r * 2 * M_PI; //total width of string in degrees $d = $t / $u * 360; $transf->StartTransform($pdf); // rotate matrix for the first letter to center the text // (half of total degrees) if ($align == 'top') { $transf->Rotate($pdf, $d / 2, $x, $y); } else { $transf->Rotate($pdf, -$d / 2, $x, $y); } //run through the string for ($i = 0; $i < strlen($text); $i++) { if ($align == 'top') { //rotate matrix half of the width of current letter + half of the width of preceding letter if ($i == 0) { $transf->Rotate($pdf, -($w[$i] / 2 / $u) * 360, $x, $y); } else { $transf->Rotate($pdf, -(($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y); } if ($fontwidth != 1) { $transf->StartTransform($pdf); $transf->ScaleX($pdf, $fontwidth * 100, $x, $y); } $pdf->SetXY($x - $w[$i] / 2, $y - $r); } else { //rotate matrix half of the width of current letter + half of the width of preceding letter if ($i == 0) { $transf->Rotate($pdf, $w[$i] / 2 / $u * 360, $x, $y); } else { $transf->Rotate($pdf, ($w[$i] / 2 + $w[$i - 1] / 2) / $u * 360, $x, $y); } if ($fontwidth != 1) { $transf->StartTransform($pdf); $transf->ScaleX($pdf, $fontwidth * 100, $x, $y); } $pdf->SetXY($x - $w[$i] / 2, $y + $r - $pdf->FontSize); } $pdf->Cell($w[$i], $pdf->FontSize, $text[$i], 0, 0, 'C'); if ($fontwidth != 1) { $transf->StopTransform($pdf); } } $transf->StopTransform($pdf); }
public function draw(\PhpSigep\Pdf\ImprovedFPDF $pdf) { $pdf->saveState(); // quantos mm cabem dentro de um pt do pdf $un = 72 / 25.4; // Desenha o elipse $k = $pdf->k; $wRect = $un * 32 / $k; $h = $un * 20 / $k; $lineWidth = 2 / $k; $pdf->SetLineWidth($lineWidth); $x = $this->x; $y = $this->y; $rx = $wRect / 2; $ry = $h / 2; $elipse = new Elipse(); $pdf->SetDrawColor(0, 0, 0); $elipse->ellipse($pdf, $x, $y, $rx, $ry); // Escreve o texto Sedex $pdf->SetFont('Arial', 'BI'); $pdf->SetXY($x, $y + 5 / $k); $fontSize = 12; if ($this->tipoServico == self::SERVICE_E_SEDEX) { $texto = 'e-SEDEX'; } else { if ($this->tipoServico == self::SERVICE_SEDEX) { $texto = 'SEDEX'; } else { if ($this->tipoServico == self::SERVICE_SEDEX_10) { $fontSize = 11; $texto = 'SEDEX 10'; } else { if ($this->tipoServico == self::SERVICE_SEDEX_12) { $fontSize = 11; $texto = 'SEDEX 12'; } else { if ($this->tipoServico == self::SERVICE_SEDEX_HOJE) { $fontSize = 11; $texto = 'SEDEX Hoje'; } } } } } $pdf->SetFontSize($fontSize); $pdf->Cell($wRect, 18 / $k, $texto, 0, 2, 'C'); // Número contrato e DR $pdf->SetFont('', '', 7); $texto = $this->accessData->getNumeroContrato() . '/' . $this->accessData->getAnoContrato() . '-DR/' . $this->accessData->getDiretoria()->getSigla(); $pdf->Cell($wRect, 6 / $k, $texto, 0, 2, 'C'); // Nome do remetente $pdf->SetFont('', 'B', 9); $pdf->MultiCell($wRect, 10 / $k, $pdf->_($this->nomeRemetente), 0, 'C'); // Insere a logo do correios na parte inferior $pdf->SetDrawColor(255, 255, 255); $pdf->SetLineWidth(10 / $k); $x1 = $x - 4 / $k; $x2 = $x1 + $pdf->GetStringWidth('CORREIOS') + 40 / $k; $y1 = $y + $h - 3 / $k; $pdf->Line($x1, $y1, $x2, $y1); $pdf->Image(realpath(dirname(__FILE__)) . '/../correios-logo.png', $x1 + 9, $y1 - 3); $pdf->restoreLastState(); }