/**
  * Monta as carteirinhas de acordo em $config e $students
  * @return FPDF
  */
 public function generatePdf()
 {
     $pdf = new FPDF('P', 'mm', 'A4');
     // Variáveis auxiliares
     $yCoordinate = self::VERTICAL_MARGIN;
     $cardVerseX = self::HORIZONTAL_MARGIN + self::GAP_BETWEEN_CARDS + self::CARD_WIDTH;
     $cardsPerPage = (int) ((297 - 2 * self::VERTICAL_MARGIN) / (self::CARD_HEIGHT + self::GAP_BETWEEN_CARDS));
     $frontFieldsX = self::HORIZONTAL_MARGIN + self::CARD_WIDTH - self::CARD_PADDING - self::FRONT_FIELDS_WIDTH;
     foreach ($this->students as $i => $student) {
         if ($i % $cardsPerPage === 0) {
             $pdf->AddPage('P', 'A4');
             $yCoordinate = self::VERTICAL_MARGIN;
         }
         $pdf->SetDrawColor(255);
         // Branco
         $pdf->SetFillColor(255);
         // Branco
         // Posiciona o background selecionado na frente da carteirinha
         $pdf->Image(self::BASE_PATH . '/public/img/' . $this->config['bg_img_url'], self::HORIZONTAL_MARGIN, $yCoordinate, self::CARD_WIDTH, self::CARD_HEIGHT);
         // Posiciona o background selecionado no verso da carteirinha
         $pdf->Image(self::BASE_PATH . '/public/img/' . $this->config['bg_img_url'], $cardVerseX, $yCoordinate, self::CARD_WIDTH, self::CARD_HEIGHT);
         // Posiciona o logo
         $pdf->Image(self::BASE_PATH . '/public/img/' . 'logo_branco.png', self::HORIZONTAL_MARGIN + self::CARD_PADDING, $yCoordinate + self::CARD_PADDING, self::LOGO_WIDTH, self::LOGO_HEIGHT);
         $pdf->Image(self::BASE_PATH . '/public/img/' . 'logo_branco.png', $cardVerseX + self::CARD_PADDING, $yCoordinate + self::CARD_PADDING, self::LOGO_WIDTH, self::LOGO_HEIGHT);
         // Define a fonte, o tamanho e a cor do texto
         $pdf->SetFont(self::FONT, '', self::TITLE_TEXT_SIZE);
         $pdf->SetTextColor(255);
         // Branco
         // Posiciona o nome do cursinho na frente
         $titleWidth = $pdf->GetStringWidth(self::TITLE);
         $pdf->Text(self::HORIZONTAL_MARGIN + self::CARD_WIDTH - $titleWidth - self::CARD_PADDING, $yCoordinate + 9.09, self::TITLE);
         // Posiciona o nome do cursinho no verso
         $pdf->Text($cardVerseX + self::CARD_WIDTH - $titleWidth - self::CARD_PADDING, $yCoordinate + 9.09, self::TITLE);
         // Posiciona a foto do aluno
         $pdf->Image(self::BASE_PATH . '/data/profile/' . $student['img_url'], self::HORIZONTAL_MARGIN + self::CARD_PADDING, $yCoordinate + 19.4, 23.44);
         // Define a fonte, o tamanho e a cor do texto
         $pdf->SetFont(self::FONT, '', self::LABEL_TEXT_SIZE);
         $pdf->SetTextColor(20);
         // Cinza
         // Posiciona o rótulo e o campo do NOME do aluno
         $nameFieldY = $yCoordinate + 24;
         $pdf->Text($frontFieldsX, $nameFieldY - 1.35, "NOME");
         $pdf->Rect($frontFieldsX, $nameFieldY, self::FRONT_FIELDS_WIDTH, self::FRONT_FIELDS_HEIGHT, 'DF');
         // Posiciona o rótulo e o campo do RG do aluno
         $rgFieldY = $yCoordinate + 34.85;
         $pdf->Text($frontFieldsX, $rgFieldY - 1.35, "RG");
         $pdf->Rect($frontFieldsX, $rgFieldY, self::FRONT_FIELDS_WIDTH, self::FRONT_FIELDS_HEIGHT, 'DF');
         // Define a fonte e o tamanho do texto
         $pdf->SetFont(self::FONT, '', self::REGULAR_TEXT_SIZE);
         // Posiciona o NOME do aluno
         $pdf->Text($frontFieldsX + 1.5, $nameFieldY + 2.78, utf8_decode($student['name']));
         // Posiciona o RG do aluno
         $pdf->Text($frontFieldsX + 1.5, $rgFieldY + 2.7, $student['rg']);
         // Posiciona a assinatura do presidente
         $signatureTxt = self::SIGNATURE;
         $ySignatureTxt = $yCoordinate + self::CARD_HEIGHT - self::CARD_PADDING;
         $pdf->Text($cardVerseX + (self::CARD_WIDTH - $pdf->GetStringWidth($signatureTxt)) / 2, $ySignatureTxt, $signatureTxt);
         // Posiciona uma linha acima do texto da assinatura
         $pdf->Line($cardVerseX + self::CARD_WIDTH * 0.2, $ySignatureTxt - 4, $cardVerseX + self::CARD_WIDTH * 0.8, $ySignatureTxt - 4, 'DF');
         $phraseFieldY = $yCoordinate + 17;
         // Posiciona o campo da frase
         $pdf->Rect($cardVerseX + self::CARD_PADDING, $phraseFieldY, self::CARD_WIDTH - 2 * self::CARD_PADDING, self::PHRASE_FIELD_HEIGHT, 'DF');
         // Define a fonte e o tamanho do texto
         $pdf->SetFont(self::FONT, '', self::PHRASE_TEXT_SIZE);
         // Posiciona a frase no verso da carteirinha
         $pdf->SetXY($cardVerseX + self::CARD_PADDING + self::PHRASE_FIELD_PADDING, $phraseFieldY + self::PHRASE_FIELD_PADDING);
         $pdf->MultiCell(self::CARD_WIDTH - 2 * self::CARD_PADDING - 2 * self::PHRASE_FIELD_PADDING, self::PHRASE_FIELD_ROW_HEIGHT, utf8_decode($this->config['phrase']));
         // Posiciona o autor
         $pdf->Text($cardVerseX + self::CARD_WIDTH - self::CARD_PADDING - self::PHRASE_FIELD_PADDING - $pdf->GetStringWidth(utf8_decode($this->config['author'])), $phraseFieldY + self::PHRASE_FIELD_HEIGHT - self::PHRASE_FIELD_PADDING, utf8_decode($this->config['author']));
         // Define a fonte e o tamanho do texto
         $pdf->SetFont(self::FONT, '', self::EXPIRY_TEXT_SIZE);
         // Posiciona a mensagem da data de validade (Válido até <dia> de <mês> de <ano>)
         $str = utf8_decode('Válido até ' . $this->config['expiry']->format('d') . ' de ' . self::MONTHS[(int) $this->config['expiry']->format('n') - 1] . ' de ' . $this->config['expiry']->format('Y'));
         $pdf->Text(self::HORIZONTAL_MARGIN + self::CARD_WIDTH - self::CARD_PADDING - $pdf->GetStringWidth($str), $yCoordinate + self::CARD_HEIGHT - self::CARD_PADDING, $str);
         // coordenada y para construção da próxima carteirinha
         $yCoordinate += self::CARD_HEIGHT + self::GAP_BETWEEN_CARDS;
     }
     return $pdf->Output('Carteirinhas', 'I', true);
 }
 public function pdf()
 {
     $pdf = new \fpdf\FPDF();
     $pdf->AddPage();
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Cell(10, 8, 'No.', 1, 0);
     $pdf->Cell(25, 8, 'Tanggal', 1, 0);
     $pdf->Cell(40, 8, 'No. Rekening', 1, 0);
     $pdf->Cell(45, 8, 'Nama', 1, 0);
     $pdf->Cell(20, 8, 'Jumlah', 1, 0);
     $pdf->Cell(50, 8, 'Operator', 1, 1);
     $transaksi = \DB::table('transaksis')->join('users', 'users.id', '=', 'transaksis.user_id')->join('nasabahs', 'nasabahs.id', '=', 'transaksis.nasabah_id')->get();
     $no = 1;
     $pdf->SetFont('Arial', '', 12);
     foreach ($transaksi as $t) {
         $pdf->Cell(10, 8, $no, 1, 0);
         $pdf->Cell(25, 8, tgl_id($t->created_at), 1, 0);
         $pdf->Cell(40, 8, $t->no_rekening, 1, 0);
         $pdf->Cell(45, 8, $t->nama_lengkap, 1, 0);
         $pdf->Cell(20, 8, $t->total, 1, 0);
         $pdf->Cell(50, 8, $t->name, 1, 1);
         $no++;
     }
     $pdf->Output();
 }
Example #3
1
 public function gerar(Boleto $boleto)
 {
     $PDF = new FPDF("P", 'mm', 'A4');
     $PDF->AddPage();
     $PDF->SetFont('Arial', '', 8);
     $PDF->Ln();
     //Select Arial bold 8
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 4, utf8_decode("Instrução de Impressão:"), '', 1, 'C');
     $PDF->Cell(190, 4, utf8_decode("Imprimir em impressora jato de tinta (ink jet) ou laser em qualidade normal. (Não use modo econômico)."), '', 1, 'C');
     $PDF->Cell(190, 4, utf8_decode("Utilize folha A4 (210 x 297 mm) ou carta (216 x 279 mm) - Corte na linha indicada:"), '', 1, 'C');
     $PDF->Ln();
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 2, 'Recibo do Sacado', '', 1, 'R');
     $PDF->SetFont('Arial', '', 12);
     $PDF->Cell(190, 2, '--------------------------------------------------------------------------------------------------------------------------------------', '', 0, 'L');
     $PDF->Ln();
     $PDF->Ln(15);
     $PDF->SetFont('Arial', '', 9);
     $PDF->Cell(50, 10, '', 'B', 0, 'L');
     $PDF->Image(Gerador::getDirImages() . $boleto->getBanco()->getLogomarca(), 10, 43, 40, 10);
     //Select Arial italic 8
     $PDF->SetFont('Arial', 'B', 14);
     $PDF->Cell(20, 10, $boleto->getBanco()->getCodigoComDigitoVerificador(), 'LBR', 0, 'C');
     $PDF->SetFont('Arial', 'B', 9);
     $PDF->Cell(120, 10, $boleto->gerarLinhaDigitavel(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(85, 3, 'Cedente', 'LR', 0, 'L');
     $PDF->Cell(30, 3, utf8_decode('Agência/Código do Cedente'), 'R', 0, 'L');
     $PDF->Cell(15, 3, utf8_decode('Espécie'), 'R', 0, 'L');
     $PDF->Cell(20, 3, 'Quantidade', 'R', 0, 'L');
     $PDF->Cell(40, 3, utf8_decode('Carteira/Nosso número'), '', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(85, 5, utf8_decode($boleto->getSacado()->getNome()), 'BLR', 0, 'L');
     $PDF->Cell(30, 5, $boleto->getCedente()->getAgenciaComDv() . " / " . $boleto->getCedente()->getContaComDv(), 'BR', 0, 'L');
     $PDF->Cell(15, 5, $boleto->getBanco()->getEspecie(), 'BR', 0, 'L');
     $PDF->Cell(20, 5, "001", 'BR', 0, 'L');
     $PDF->Cell(40, 5, $boleto->getCarteiraENossoNumeroComDigitoVerificador(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(60, 3, utf8_decode('Número do Documento'), 'LR', 0, 'L');
     $PDF->Cell(35, 3, 'CPF/CNPJ', 'R', 0, 'L');
     $PDF->Cell(35, 3, 'Vencimento', 'R', 0, 'L');
     $PDF->Cell(60, 3, 'Valor Documento', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(60, 5, $boleto->getNossoNumero(), 'BLR', 0, 'L');
     $PDF->Cell(35, 5, $boleto->getCedente()->getCpfCnpj(), 'BR', 0, 'L');
     $PDF->Cell(35, 5, $boleto->getDataVencimento()->format('d/m/Y'), 'BR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getValorBoleto(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(33, 3, '(-)Desconto/Abatimentos', 'LR', 0, 'L');
     $PDF->Cell(32, 3, utf8_decode('(-)Outras deduções'), 'R', 0, 'L');
     $PDF->Cell(32, 3, '(+)Mora/Multa', 'R', 0, 'L');
     $PDF->Cell(33, 3, utf8_decode('(+)Outros acréscimos'), '', 0, 'L');
     $PDF->Cell(60, 3, '(*)Valor Cobrado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(33, 5, '', 'BLR', 0, 'L');
     $PDF->Cell(32, 5, '', 'BR', 0, 'L');
     $PDF->Cell(32, 5, '', 'BR', 0, 'L');
     $PDF->Cell(33, 5, '', 'BR', 0, 'L');
     $PDF->Cell(60, 5, '', 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(190, 3, 'Sacado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getNome()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getTipoLogradouro() . " " . $boleto->getSacado()->getEnderecoLogradouro() . ", " . $boleto->getSacado()->getNumeroLogradouro()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getCidade() . " - " . $boleto->getSacado()->getUf() . " - CEP: " . $boleto->getSacado()->getCep()), 'BL', 1, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(170, 3, utf8_decode('Instruções'), '', 0, 'L');
     $PDF->Cell(20, 3, utf8_decode('Autênticação Mecânica'), '', 1, 'R');
     $PDF->SetFont('Arial', '', 7);
     foreach ($boleto->getInstrucoes() as $instrucao) {
         $PDF->Cell(190, 5, utf8_decode($instrucao), '', 1, 'L');
     }
     $PDF->Ln();
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 2, 'Corte na linha pontilhada', '', 1, 'R');
     $PDF->SetFont('Arial', '', 12);
     $PDF->Cell(190, 2, '--------------------------------------------------------------------------------------------------------------------------------------', '', 0, 'L');
     $PDF->Ln(10);
     $PDF->Cell(50, 10, '', 'B', 0, 'L');
     $PDF->Image(Gerador::getDirImages() . $boleto->getBanco()->getLogomarca(), 10, 130, 40, 10);
     //Select Arial italic 8
     $PDF->SetFont('Arial', 'B', 14);
     $PDF->Cell(20, 10, $boleto->getBanco()->getCodigoComDigitoVerificador(), 'LBR', 0, 'C');
     $PDF->SetFont('Arial', 'B', 9);
     $PDF->Cell(120, 10, $boleto->gerarLinhaDigitavel(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(130, 3, 'Local Pagamento', 'LR', 0, 'L');
     $PDF->Cell(60, 3, 'Vencimento', '', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, utf8_decode($boleto->getBanco()->getLocalPagamento()), 'BLR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getDataVencimento()->format('d/m/Y'), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(130, 3, 'Cedente', 'LR', 0, 'L');
     $PDF->Cell(60, 3, utf8_decode('Agência/Código cedente'), '', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, utf8_decode($boleto->getCedente()->getNome()), 'BLR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getCedente()->getAgenciaComDv() . " / " . $boleto->getCedente()->getContaComDv(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(28, 3, 'Data Documento', 'LR', 0, 'L');
     $PDF->Cell(40, 3, utf8_decode('Número do Documento'), 'R', 0, 'L');
     $PDF->Cell(20, 3, utf8_decode('Espécie doc.'), 'R', 0, 'L');
     $PDF->Cell(20, 3, 'Aceite', 'R', 0, 'L');
     $PDF->Cell(22, 3, 'Data processamento', '', 0, 'L');
     $PDF->Cell(60, 3, utf8_decode('Carteira / Nosso número'), 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(28, 5, $boleto->getDataDocumento()->format('d/m/Y'), 'BLR', 0, 'L');
     $PDF->Cell(40, 5, $boleto->getNumeroDocumento(), 'BR', 0, 'L');
     $PDF->Cell(20, 5, $boleto->getBanco()->getEspecieDocumento(), 'BR', 0, 'L');
     $PDF->Cell(20, 5, "", 'BR', 0, 'L');
     $PDF->Cell(22, 5, $boleto->getDataProcessamento()->format('d/m/Y'), 'BR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getCarteiraENossoNumeroComDigitoVerificador(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(28, 3, 'Uso do Banco', 'LR', 0, 'L');
     $PDF->Cell(25, 3, 'Carteira', 'R', 0, 'L');
     $PDF->Cell(15, 3, utf8_decode('Espécie'), 'R', 0, 'L');
     $PDF->Cell(40, 3, 'Quantidade', 'R', 0, 'L');
     $PDF->Cell(22, 3, '(x)Valor', '', 0, 'L');
     $PDF->Cell(60, 3, '(=)Valor Documento', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(28, 5, '05/05/2014', 'BLR', 0, 'L');
     $PDF->Cell(25, 5, $boleto->getBanco()->getCarteira(), 'BR', 0, 'L');
     $PDF->Cell(15, 5, $boleto->getBanco()->getEspecie(), 'BR', 0, 'L');
     $PDF->Cell(40, 5, "001", 'BR', 0, 'L');
     $PDF->Cell(22, 5, '', 'BR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getValorBoleto(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(130, 3, utf8_decode('Instruções'), 'L', 0, 'L');
     $PDF->Cell(60, 3, '(-)Desconto/Abatimentos', 'L', 1, 'L');
     $l = 0;
     for ($i = 0; $i < 4; $i++) {
         $instrucao = isset($boleto->getInstrucoes()[$i]) ? $boleto->getInstrucoes()[$i] : null;
         $l++;
         $PDF->Cell(130, 5, utf8_decode($instrucao), 'L', 0, 'L');
         if (1 == $l) {
             $PDF->Cell(60, 5, '', 'LB', 1, 'R');
         } else {
             if (2 == $l) {
                 $PDF->SetFont('Arial', '', 6);
                 $PDF->Cell(60, 3, utf8_decode('(-)Outras deduções'), 'L', 1, 'L');
             } else {
                 if (3 == $l) {
                     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
                 } else {
                     if (4 == $l) {
                         $PDF->SetFont('Arial', '', 6);
                         $PDF->Cell(60, 3, '(+)Mora/Multa', 'L', 1, 'L');
                     }
                 }
             }
         }
     }
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, '', 'L', 0, 'L');
     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
     $PDF->Cell(130, 3, '', 'L', 0, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(60, 3, utf8_decode('(+)Outros acréscimos'), 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, '', 'L', 0, 'L');
     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
     $PDF->Cell(130, 3, '', 'L', 0, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(60, 3, '(=)Valor cobrado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, '', 'LB', 0, 'L');
     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(190, 3, 'Sacado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getNome()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getTipoLogradouro() . " " . $boleto->getSacado()->getEnderecoLogradouro() . ", " . $boleto->getSacado()->getNumeroLogradouro()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getCidade() . " - " . $boleto->getSacado()->getUf() . " - CEP: " . $boleto->getSacado()->getCep()), 'BL', 1, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(170, 3, 'Sacador/Avalista', '', 0, 'L');
     $PDF->Cell(20, 3, utf8_decode('Autênticação Mecânica - Ficha de Compensação'), '', 1, 'R');
     $this->fbarcode($boleto->getLinha(), $PDF);
     $PDF->Ln(10);
     $PDF->SetY(260);
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 2, 'Corte na linha pontilhada', '', 1, 'R');
     $PDF->SetFont('Arial', '', 12);
     $PDF->Cell(190, 2, '--------------------------------------------------------------------------------------------------------------------------------------', '', 0, 'L');
     return $PDF;
 }
 /**
  * @param Certificado $certificado
  * @throws \Exception
  */
 public function crearPdf(Certificado $certificado)
 {
     $empleado = new Empleado($certificado->cedula_empleado);
     //echo print_r($empleado);
     //$empleado = new Empleado();
     $pdf = new FPDF('P', 'cm', 'Letter');
     //$pdf = new FPDF_Protection();
     //$pdf->SetProtection(array('print'));
     $pdf->AddPage();
     $pdf->SetMargins(3, 3, 2);
     $pdf->SetAutoPageBreak(true, 1);
     $pdf->SetLineWidth(1.5);
     $pdf->SetFont('Arial');
     $pdf->Image(realpath(__DIR__ . '/../../../../assets/images/logo.png'), 14, 0.3, 5, 'PNG');
     $pdf->SetFont('Arial', '', 6);
     $pdf->Cell(17.5, 6, $certificado->id, 0, 2, 'R');
     $pdf->SetFont('Arial', '', 12);
     $pdf->Ln(0);
     $pdf->Cell(0, 0, 'Valledupar, ' . $this->formatFecha($certificado->fecha), 0, 2, 'L');
     $pdf->Ln(2);
     $pdf->Cell(0, 0, 'EL DEPARTAMENTO DE TALENTO HUMANO', 0, 2, 'C');
     $pdf->Ln(1);
     $pdf->Cell(0, 0, utf8_decode('DE LÁCTEOS DEL CESAR S.A.'), 0, 2, 'C');
     $pdf->Ln(2);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(0, 0, 'CERTIFICA:', 0, 2, 'C');
     $pdf->Ln(2);
     $pdf->SetFont('Arial');
     $contratoEmpleado = $empleado->getContrato();
     $salario = '.';
     if ($certificado->tipo == 2) {
         $salario = ', devengando un salario básico mensual de $' . number_format($contratoEmpleado->salario) . '.';
     }
     if ($certificado->tipo == 3) {
         $salario = ', devengando un salario promedio mensual de $' . number_format($contratoEmpleado->salarioPromedio(), 0, '', '.') . '.';
     }
     $labora = 'labora';
     $feca_contratacion = "desde el " . $this->formatFecha($contratoEmpleado->fecha_ingreso);
     if ($contratoEmpleado->getEstado() == 'retirado') {
         $labora = 'laboró';
         $feca_contratacion .= ', hasta el ' . $this->formatFecha($contratoEmpleado->fecha_retiro);
     } else {
         $feca_contratacion = ' mediante contrato ' . $contratoEmpleado->getTipo() . ', ' . $feca_contratacion;
     }
     $pdf->MultiCell(0, 0.6, utf8_decode('Que el señor(a) ' . strtoupper($empleado->nombres . ' ' . $empleado->apellido1 . ' ' . $empleado->apellido2 . ' ') . 'con cédula de ciudadanía ' . $empleado->cedula . ", {$labora} en esta compañía en el cargo de " . $contratoEmpleado->getCargo()->nombre . ', ' . $feca_contratacion . $salario), 0, 'J', false);
     $pdf->Ln(2);
     $pdf->Cell(0, 0, utf8_decode('Esta certificación se expide a solicitud del interesado.'), 0, 2);
     $pdf->Ln(5);
     $pdf->Image(realpath(__DIR__ . '/../../../../assets/images/Firma.png'), 8, 19, 7, 'PNG');
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(0, 0, 'MAYRA ALEJANDRA CARO DAZA', 0, 2, 'C');
     $pdf->Ln(0.5);
     $pdf->SetFont('Arial');
     $pdf->Cell(0, 0, 'Jefe de Talento Humano', 0, 2, 'C');
     $pdf->Image(realpath(__DIR__ . '/../../../../assets/images/Pie.JPG'), 1, 25.5, 19, 'JPG');
     $pdf->Output($certificado->id . '.pdf', 'I');
     return true;
 }
Example #5
0
 public function AddPage($orientation = '', $size = '')
 {
     parent::AddPage();
     $this->Header();
     $this->mindPageY = $this->config->get('topMargin');
 }
 /**
  * @return string
  */
 public function Export()
 {
     $assetPath = ASSETS_PATH;
     $reflowPath = REFLOW_DIR;
     $deckSegment = $this->URLSegment;
     $manager = new ProcessManager();
     $manager->setLogPath(ASSETS_PATH);
     $rule = new InMemoryRule();
     $rule->setProcesses(5);
     $rule->setMinimumProcessorUsage(0);
     $rule->setMaximumProcessorUsage(100);
     $manager->addRule($rule);
     $manager->addTask(new ProcessCallbackTask(function () use($assetPath, $deckSegment) {
         exec("mkdir {$assetPath}/{$deckSegment}/export");
     }));
     /** @var Slide $slide */
     foreach ($this->Slides() as $slide) {
         $slideLink = $slide->AbsoluteLink("Capture");
         $slideSegment = $slide->URLSegment;
         $link = rtrim($this->AbsoluteLink(), "/") . "#" . $slide->URLSegment;
         $manager->addTask(new ProcessCallbackTask(function () use($link, $assetPath, $reflowPath, $slideLink, $slideSegment, $deckSegment) {
             $client = Client::getInstance();
             $client->setBinDir($reflowPath . "/../vendor/bin");
             /**
              * @see JonnyW\PhantomJs\Message\CaptureRequest
              **/
             $request = $client->getMessageFactory()->createCaptureRequest($link, "GET");
             $request->setViewportSize(1440, 900);
             // TODO
             $request->setDelay(3);
             // TODO
             $request->setCaptureFile("{$assetPath}/{$deckSegment}/{$slideSegment}.png");
             /**
              * @see JonnyW\PhantomJs\Message\Response
              **/
             $response = $client->getMessageFactory()->createResponse();
             // Send the request
             $client->send($request, $response);
         }));
         print "Exporting: " . $slide->Title . "<br>";
     }
     $slides = [];
     /** @var Slide $slide */
     foreach ($this->Slides() as $slide) {
         $slideSegment = $slide->URLSegment;
         $slides[] = "{$assetPath}/{$deckSegment}/export/{$slideSegment}.png";
     }
     while ($manager->tick()) {
         usleep(10);
     }
     $manager->addTask(new ProcessCallbackTask(function () use($assetPath, $deckSegment, $slides) {
         $pdf = new FPDF();
         /** @var Slide $slide */
         foreach ($slides as $slide) {
             $pdf->AddPage("L", array(15 * 72, 9.380000000000001 * 72));
             $pdf->Image($slide, 0, 0, 15 * 72, 9.380000000000001 * 72);
         }
         $pdf->Output("{$assetPath}/{$deckSegment}/export.pdf", "F");
     }));
     while ($manager->tick()) {
         usleep(10);
     }
 }
Example #7
0
 public function AddPage($orientation = '')
 {
     parent::AddPage($orientation);
     if ($this->page > 1) {
         $this->Cell(0, 4, $this->titulo, 'B', '', 'l');
         $this->x -= 36;
         $this->Cell(36, 4, 'Pag.: ' . $this->page, '', '', 'R');
         $this->ln();
         $this->Cell(0, 2, '', '', 1, 'L');
         if ($this->suprimirCabecalhoColunas == false) {
             $this->setCabecalhoColunas();
         }
         $this->suprimirCabecalhoColunas = false;
     } else {
         $this->setCabecalhoRelatorio();
         $this->ln();
         $this->ln();
         if ($this->indiceQuebra < 0) {
             $this->setCabecalhoColunas();
         }
     }
     $this->fill = true;
     $this->regPagina = 0;
 }
Example #8
0
File: TPL.php Project: artack/fpdi
 /**
  * See FPDF-Documentation ;-)
  *
  * AddPage is not available when you're "in" a template.
  */
 function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false)
 {
     if (is_subclass_of($this, 'TCPDF')) {
         $args = func_get_args();
         return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
     }
     if ($this->_intpl) {
         $this->Error('Adding pages in templates isn\'t possible!');
     }
     parent::AddPage($orientation, $format);
 }