/** * @Route("/vacature/pdf/{urlid}", name="vacancy_pdf_by_urlid") */ public function createPdfAction($title) { $t = $this->get('translator'); $vacancy = $this->getVacancyRepository()->findOneByUrlid($title); if ($vacancy) { $pdf = new \FPDF_FPDF("P", "pt", "A4"); $pdf->AddPage(); $pdf->SetFont("Times", "B", 12); $pdf->Cell(0, 10, $vacancy->getTitle(), 0, 2, "C"); $pdf->MultiCell(0, 20, "Beschrijving: \t" . $vacancy->getDescription()); $pdf->MultiCell(0, 20, "Organisatie: \t" . $vacancy->getOrganisation()->getStreet(), 0, "L"); $pdf->MultiCell(0, 20, "Locatie: \t", 0, "L"); $pdf->Output(); return $this->render($pdf->Output()); } else { throw new \Exception($t->trans('vacancy.createPdf.exception')); } }
public function generarplantillaTempPdf($titulo, $paciente, $plantilla, $consulta, $fecha, $urlLogo, $valores) { $pdf = new \FPDF_FPDF(); $pdi = new \FPDF_FPDI(); $logo = $urlLogo . 'sonodigest.jpg'; //var_dump($logo); $this->pdf->FPDF('P', 'mm', 'Letter'); $this->pdf->SetTopMargin(0); $this->pdf->SetLeftMargin(20); $this->pdf->SetAutoPageBreak(true, 6); $this->pdf->AddPage(); $this->pdf->SetFillColor(255); //var_dump($plantilla[0]->getPlantilla()); $this->pdf->SetFont('Arial', 'B', 16); $pdf->Cell(120, 32, $plantilla[0]->getPlantilla()->getNombre()); $this->pdf->Image($logo, 150, 5, 50, 20); $this->pdf->Line(20, 25.5, 200, 25.5); $this->pdf->Line(20, 26, 200, 26); $this->pdf->SetFont('Arial', 'B', 13); $break = 0; $this->pdf->Cell(180, 32, $titulo, 0, 0); $this->pdf->Ln(26); $break = $break + 26; $this->pdf->Cell(32, 27, 'Informacion general del paciente'); $this->pdf->Line(20, 43, 200, 43); $this->pdf->Ln(15); $break = $break + 15; $this->mostrarCelda($this->pdf, 32, 'Fecha: ', $fecha); $this->mostrarCelda($this->pdf, 22, 'Estado civil:', $paciente->getEstadoCivil()); $this->pdf->Ln(7); $break = $break + 7; $this->mostrarCelda($this->pdf, 32, 'Nombre: ', $paciente->getPersona()->getNombres() . ' ' . $paciente->getPersona()->getApellidos()); // var_dump($paciente->getFechaNacimiento()); if ($paciente->getFechaNacimiento() != null) { $fecha = $paciente->getFechaNacimiento()->format("Y-m-d"); list($Y, $m, $d) = explode("-", $fecha); $edad = date("md") < $m . $d ? date("Y") - $Y - 1 : date("Y") - $Y; $this->mostrarCelda($this->pdf, 13, 'Edad: ', $edad); } else { $fecha = 'La fecha no registrada'; $this->mostrarCelda($this->pdf, 13, 'Edad: ', $fecha); } $this->pdf->Ln(7); $break = $break + 7; // var_dump($paciente->getExpediente()[0]); if ($paciente->getExpediente()[0] != null) { $this->mostrarCelda($this->pdf, 32, 'Expediente No.: ', $paciente->getExpediente()[0]->getNumero()); } else { $this->mostrarCelda($this->pdf, 32, 'Expediente No.: ', ' '); } $sexoPaciente = $paciente->getSexo(); $sexo = ''; if ($sexoPaciente == 'M') { $sexo = 'Masculino'; } if ($sexoPaciente == 'F') { $sexo = 'Femenino'; } $this->mostrarCelda($this->pdf, 13, 'Sexo: ', $sexo); $this->pdf->Ln(10); $break = $break + 10; $this->pdf->SetFont('Arial', 'B', 13); $this->pdf->Cell(32, 27, 'Resultado de consulta'); $this->pdf->Line(20, 81, 200, 81); $this->pdf->Ln(18); $break = $break + 18; $this->pdf->SetDrawColor(255, 255, 255); $this->pdf->SetWidths(array(55, 126)); $this->pdf->SetFont('Arial', '', 10); foreach ($plantilla as $key => $value) { $this->pdf->Row(array($value->getNombre(), $valores[$key])); $this->pdf->Ln(4); // $pdf->SetX(25); // $pdf->SetFont('Arial','B',10); // $pdf->MultiCell(40, 5, $value->getNombre().': ', 0, 'L', false); // $pdf->SetX(66.6); // $pdf->SetFont('Arial','',10); // $pdf->MultiCell(135, 5, $value->getValorDetalle(), 0, 'J', false); // $pdf->Ln(10); } // foreach ($plantilla as $key =>$value) { // $pdf->SetX(25); // $pdf->SetFont('Arial','B',10); //$pdf->SetY($break); //$break=$break-5; //$pdf->SetY($break); // $pdf->SetFillColor(0,0,255); // $pdf->MultiCell(40, 4, $value->getNombre(), 0, 'L', false); // $pdf->SetFont('Arial','',10); //$break=$break-1; //$pdf->SetY($break); // $pdf->SetX(66.6); //$pdf->MultiCell(135, 5, $valores[$key], 1, 'J', false); // $pdf->SetFillColor(0,255,0); // $pdf->MultiCell(105, 5, $valores[$key], 0, 'J', false); //$break=$break+5; //$pdf->SetY($break); // $this->pdf->Ln(10); //$break=$break+10; //$pdf->SetY($break); // } //$tam = count($consulta); //$espacio = //$pdf->Ln(55); $this->pdf->SetY(241); $this->pdf->SetX(20); $this->pdf->SetFont('Arial', '', 9); $this->pdf->Cell(85, 27, 'Colonia Escalon, Calle Cuscatlan, No. 448, San Salvador.'); $this->pdf->Ln(5); $this->pdf->SetX(20); $this->pdf->Cell(85, 27, 'Entre la 83 Av. y 85 Av. Sur. Tel.: 25192857'); $this->pdf->SetFont('Arial', '', 11); $this->pdf->SetY(235); $this->pdf->SetX(156); $this->pdf->Cell(88, 27, $medico['nombre']); $this->pdf->Ln(5); $this->pdf->SetX(160); $this->pdf->Cell(85, 27, $medico['cargo']); $this->pdf->Ln(5); $this->pdf->SetX(178); $this->pdf->Cell(85, 27, $medico['codigo']); // $pdf->Output(); $this->pdf->Output(); return $this->pdf; }
/** * Private Method */ function _out($s) { if ($this->state == 2 && $this->_intpl) { $this->tpls[$this->tpl]['buffer'] .= $s . "\n"; } else { parent::_out($s); } }