/** * @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 generarrecetaTempPdf($titulo, $paciente, $plantilla, $consulta, $fecha, $urlLogo, $valores, $medico, $otros) { //public function generarConsultaReceta($urlLogo, $consulta, $medico, $otros){ $pdf = new \FPDF_FPDF(); $pdi = new \FPDF_FPDI(); $logo = $urlLogo . 'laplusbelle.jpg'; $logo2 = $urlLogo . 'sonodigest.jpg'; html_entity_decode("á"); $pdf->FPDF('P', 'mm', 'Letter'); $pdf->SetTopMargin(0); $pdf->SetLeftMargin(20); $pdf->SetAutoPageBreak(true, 6); $pdf->AddPage(); $pdf->SetFillColor(255); $pdf->SetFont('Arial', 'B', 16); // $pdf->Cell(120,32,$consulta[0]->getDetallePlantilla()->getPlantilla()->getNombre()); $pdf->Cell(70); //$pdf->Cell(120,32,utf8_decode($consulta[0]->getDetallePlantilla()->getPlantilla()->getNombre())); $pdf->Cell(120, 32, utf8_decode('Receta médica')); $pdf->Image($logo, 20, 5, 50, 20); $pdf->Image($logo2, 150, 5, 50, 20); $pdf->Line(20, 25.5, 200, 25.5); $pdf->Line(20, 26, 200, 26); $pdf->SetFont('Arial', '', 11); $pdf->SetY(20); $pdf->SetX(20); $pdf->Cell(88, 27, $medico['nombre']); $pdf->Ln(5); $pdf->SetX(20); $pdf->Cell(85, 27, $medico['cargo']); $pdf->Ln(5); $pdf->SetX(20); $pdf->Cell(85, 27, $medico['codigo']); //var_dump($otros); $i = 20; foreach ($otros as $key => $otro) { $pdf->SetY($i); $pdf->SetX(140); $pdf->Cell(20, 25, utf8_decode($otros[$key])); $i = $i + 4; } $pdf->SetFont('Arial', 'B', 13); $pdf->Ln(15); $pdf->Cell(20, 20, utf8_decode('Información general del paciente')); //$pdf->Line(20, 47, 200, 47); $pdf->Ln(5); $this->mostrarCelda($pdf, 32, 'Fecha: ', $fecha); $this->mostrarCelda($pdf, 32, 'Proxima cita: ', '_______________'); $pdf->Ln(7); //var_dump($paciente->getPersona()->getNombres()); $this->mostrarCelda($pdf, 32, 'Nombre: ', utf8_decode($paciente->getPersona()->getNombres() . ' ' . $paciente->getPersona()->getApellidos())); 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($pdf, 13, 'Edad: ', $edad); } else { $fecha = 'La fecha no registrada'; $this->mostrarCelda($pdf, 13, 'Edad: ', $fecha); } $pdf->Ln(7); // $this->mostrarCelda($pdf, 32, 'Expediente No.: ', $paciente->getExpediente()[0]->getNumero()); if ($paciente->getExpediente()[0] != null) { $this->mostrarCelda($pdf, 32, 'Expediente No.: ', $paciente->getExpediente()[0]->getNumero()); } else { $this->mostrarCelda($pdf, 32, 'Expediente No.: ', ' '); } $sexoPaciente = $paciente->getSexo(); $sexo = ''; if ($sexoPaciente == 'M') { $sexo = 'Masculino'; } if ($sexoPaciente == 'F') { $sexo = 'Femenino'; } $this->mostrarCelda($pdf, 13, 'Sexo: ', $sexo); $pdf->Ln(10); $pdf->SetFont('Arial', 'B', 13); $pdf->Cell(32, 27, 'FX:'); // $pdf->Cell(40, 27, $plantilla[0]->getPlantilla()->getNombre().': ', 0, 'L', false); $pdf->Line(20, 97, 200, 97); $pdf->Ln(18); // foreach ($consulta as $value) { // $pdf->SetX(25); // $pdf->SetFont('Arial','B',10); // // $pdf->SetX(30); // $pdf->SetFont('Arial','',10); // $pdf->MultiCell(170, 5, $value->getValorDetalle(), 0, 'J', false); // $this->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', true); $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(170, 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); $pdf->Line(20, 244, 200, 244); $pdf->Line(20, 245, 200, 245); $pdf->SetY(241); $pdf->SetX(20); $pdf->SetFont('Arial', '', 12); $pdf->Cell(85, 20, 'Tel.: 2519-2857 , 7861-0599'); $pdf->Ln(2); $pdf->Cell(55, 27, utf8_decode('Colonia Escalon, Calle Cuscatlan, No. 448, San Salvador.')); $pdf->Ln(5); $pdf->SetX(20); $pdf->Output(); // return $pdf; }
/** * See FPDF-Documentation ;-) */ function SetFont($family, $style = '', $size = 0) { /** * force the resetting of font changes in a template */ if ($this->_intpl) { $this->FontFamily = ''; } parent::SetFont($family, $style, $size); $fontkey = $this->FontFamily . $this->FontStyle; if ($this->_intpl) { $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; } else { $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; } }