public function ActionCreatePDF($id) { $mpdf = Yii::app()->ePdf->mpdf(); $model_historia = $this->loadModel($id); $model_historiaO_paciente = HistoriaObstetricia::model()->getHistoriasObstetriciaByPaciente($model_historia->paciente->id); $model_historiaG_paciente = HistoriaGinecologia::model()->getHistoriasGinecologicasByPaciente($model_historia->paciente->id); $historia = array($model_historiaG_paciente, $model_historiaO_paciente); $stylesheet = file_get_contents('C:\\wamp\\www\\Gineobs\\themes\\hebo\\css\\pdfMain.css'); //configurando pdf general $mpdf = new mPDF('utf-8', 'Letter-L'); //agregando header y footer $mpdf->SetHeader('{DATE j-m-Y}||Recipe #' . $model_historia->paciente->id); $mpdf->SetFooter('Dr. María Hernández|Ginecologia y obstetricia|{PAGENO}'); //Propiedades del PDF $mpdf->setTitle("Historia Medica"); $mpdf->setAuthor("María Hernández"); $mpdf->setCreator("Edgar Cardona y Gabriela Soto"); $mpdf->setSubject("Historia medica de pacientes."); $mpdf->setKeywords("Historia,Medicina"); //escribiendo CSS $mpdf->WriteHTML($stylesheet, 1); //Escribiendo PDF $mpdf->writeHTML($this->renderPartial('historia', array('model' => $model_historia->paciente->id, 'historia' => $historia), true), 2); //Salida $mpdf->output("Recipe Medico", EYiiPdf::OUTPUT_TO_DOWNLOAD); }
public function render($file = NULL) { // Render the HTML normally $html = parent::render($file); // Render the HTML to a PDF $mpdf = new mPDF('UTF-8', 'A4'); $mpdf->SetAutoFont(AUTOFONT_ALL); $mpdf->WriteHTML($html); return $mpdf->output(); }
static function generatePDF($content, $orientation = 'P') { include GLPI_ROOT . "/plugins/monitoring/lib/mpdf/mpdf.php"; $format = 'A4'; if ($orientation == 'L') { $format .= '-L'; } $pdf = new mPDF('c', $format, '', '', 5, 5, 10, 10, 2, 2, $orientation); $pdf->mirrorMargins = true; $pdf->SetDisplayMode('fullpage'); $pdf->showImageErrors = true; $css = file_get_contents(GLPI_ROOT . '/plugins/monitoring/css/pdf.css'); $pdf->WriteHTML($css, 1); $content = "<body>" . $content . "</body>"; $pdf->WriteHTML($content, 2); $pdf->output(); // $out = $pdf->output(GLPI_PLUGIN_DOC_DIR.'/monitoring/example_001.pdf', 'F'); exit; }
if (!empty($jawaban->benar)) { $point = $jawaban->benar * $point->point_soal; } else { $point = 0; } $this->db->where('username', $data->kd_anggota); $status_ujian = $this->db->get('tb_users')->row(); if ($status_ujian->status_ujian == 'ujian') { $status = '<small class="label label-warning">Sedang Ujian</small>'; } elseif ($status_ujian->status_ujian == 'selesai') { $status = '<small class="label label-success">Selesai Dikerjakan</small>'; } else { $status = '<small class="label label-danger">Belum Ujian</small>'; } $s .= '<tr>'; $s .= '<td width="10" align="center">' . $no++ . '</td>'; $s .= '<td width="10" align="center">' . $data->kd_anggota . '</td>'; $s .= '<td width="10" align="center">' . $anggota->nama . '</td>'; $s .= '<td width="10" align="center">' . $jawaban->benar . '</td>'; $s .= '<td width="10" align="center">' . $salah . '</td>'; $s .= '<td width="10" align="center">' . $jawaban_peserta->num_rows() . ' / ' . $jumlah_soal->num_rows() . ' soal</td>'; $s .= '<td width="10" align="center">' . $point . '</td>'; $s .= '</tr>'; } $s .= '</table>'; $mpdf = new mPDF('c', 'A4', '', '', 10, 10, 10, 10, 16, 13); $mpdf->SetDisplayMode('fullpage'); $mpdf->list_indent_first_level = 0; $mpdf->WriteHTML($s, 2); $mpdf->output($filename, 'I');
/** * Delegate to mpdf * @param type $name * @param type $dest * @return type */ public function output($name = '', $dest = '') { return $this->mpdf->output($name, $dest); }
public function createPDF($id) { $model = $this->loadModel($id); $stylesheet = file_get_contents('C:\\xampp\\htdocs\\Gineobs\\themes\\hebo\\css\\pdfMain.css'); $texto = '<div id=contenedor>'; $texto = $texto . '<div id=columna1>'; $texto = $texto . '<H1 class="h1PDF"> Dra. Maria C. Hernandez N.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Ginecologo-Obstetra.</H1>'; $texto = $texto . '<H1 class="h1PDF"> C.C. Galeno Center Of. C8 Av. Country Club. Bna.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Telf. 0281-2743367/0414-8240064. CM972.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Rif: 3956719-5 MSAS 18083.</H1>'; $texto = $texto . '</div>'; $texto = $texto . '<div id=columna2>'; $texto = $texto . '<H1 class="h1PDF"> Dra. Maria C. Hernandez N.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Ginecologo-Obstetra.</H1>'; $texto = $texto . '<H1 class="h1PDF"> C.C. Galeno Center Of. C8 Av. Country Club. Bna.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Telf. 0281-2743367/0414-8240064. CM972.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Rif: 3956719-5 MSAS 18083.</H1>'; $texto = $texto . '</div>'; $texto = $texto . '<div id=columna1>'; $texto = $texto . '<p>Medicina: ' . $this->visualizarArreglo($model->recipeMedicinas, 'nombre') . '</p>'; $texto = $texto . '<p>Indicaciones: ' . $model->indicaciones . ' </p>'; $texto = $texto . '<p>Paciente: ' . Paciente::GET_NOMBRE_COMPLETO_PK($model->paciente_id) . ' </p>'; $texto = $texto . '<p>Fecha de creacion: ' . $model->fecha . ' </p>'; $texto = $texto . '</div>'; $texto = $texto . '</div>'; /* $mpdf->writeHTML( $this->render('create',null ,true) );*/ //Propiedades del header y footer // $mpdf->defaultheaderfontsize=10; // $mpdf->defaultheaderfontstyle='B'; // $mpdf->defaultheaderline=0; // $mpdf->defaultfooterfontsize=10; // $mpdf->defaultfooterfontstyle='BI'; // $mpdf->defaultfooterline=0; //configurando pdf general $mpdf = new mPDF('utf-8', 'Letter-L'); //agregando header y footer $mpdf->SetHeader('{DATE j-m-Y}||Recipe #' . $model->id); $mpdf->SetFooter('Dr. María Hernández|Ginecologia y obstetricia|{PAGENO}'); //Propiedades del PDF $mpdf->setTitle("Recipe Medico"); $mpdf->setAuthor("María Hernández"); $mpdf->setCreator("Edgar Cardona y Gabriela Soto"); $mpdf->setSubject("Recipe medico para tratamiento de pacientes."); $mpdf->setKeywords("Recipe,Medico"); //escribiendo CSS $mpdf->WriteHTML($stylesheet, 1); //Escribiendo PDF $mpdf->writeHTML($texto, 2); //Salida $mpdf->output("Recipe Medico", EYiiPdf::OUTPUT_TO_BROWSER); }