saveState() public method

public saveState ( )
Example #1
0
 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();
 }
Example #2
0
 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();
 }
Example #3
0
 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();
 }
Example #4
0
 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();
 }
 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);
             }
         }
     }
 }
Example #6
0
 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();
 }
Example #7
0
 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();
 }