public function imprimirOrdenCompra($detalle, $anexos, $system, $id_orden){ require_once(APP_PATH . 'common/plugins/sigma/demos/export_php/html2pdf/html2pdf.class.php'); template()->buildFromTemplates('report/orden_compra.html'); page()->setTitle('Orden de compra'); page()->addEstigma("detalle", array('SQL', $detalle)); page()->addEstigma("anexos", array('SQL', $anexos)); page()->addEstigma("norden", $id_orden); page()->addEstigma("nombre_empresa", $system->nombre_comercial); page()->addEstigma("direccion_empresa", $system->direccion); @template()->parseOutput(); @template()->parseExtras(); $html2pdf = new HTML2PDF('L', 'lette', 'es'); $html2pdf->WriteHTML(page()->getContent()); $html2pdf->Output('ticket.pdf'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getIndex($order_id) { $id = $order_id; $invoicedata = Invoice::where('Id', $id)->get(); $html22 = View('viewinvoice')->with(array('invoicedata' => $invoicedata))->render(); require_once app_path() . '/libs/html2pdf/html2pdf.class.php'; $html2pdf = new \HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); // $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($html22); $html2pdf->Output('Invoice.pdf'); }
public function cetak() { ob_start(); $data['siswa'] = $this->siswa_model->view(); $this->load->view('print', $data); $html = ob_get_contents(); ob_end_clean(); require_once './assets/html2pdf/html2pdf.class.php'; $pdf = new HTML2PDF('P', 'A4', 'en'); $pdf->WriteHTML($html); $pdf->Output('TOEFL_Exam_Report.pdf', 'D'); }
public function generarPDF() { $sql = "SELECT codigo,nombre,apellido,cedula,edad,semestre from estudiante"; $resultado = $this->objCon->Ejecutar($sql); if ($resultado && pg_numrows($resultado) > 0) { require_once '../Recursos/html2pdf/html2pdf.class.php'; // Se carga la libreria ob_start(); //Habilita el buffer para la salida de datos ob_get_clean(); //Limpia lo que actualmente tenga el buffer //En la variable content entre las etiquetas <page></page> va todo el contenido del pdf en formato html $content = "<page>"; $content .= "<h1>ESTE ES EL REPORTE</h1>"; $content .= '<link href="../Recursos/css/estilosPDF.css" type="text/css" rel="stylesheet">'; $content .= "<table border='1'>"; $content .= "<tr>"; $content .= "<th>Codigo</th>"; $content .= "<th>Nombre</th>"; $content .= "<th>Apellido</th>"; $content .= "<th>Cedula</th>"; $content .= "<th>Edad</th>"; $content .= "<th>Semestre</th>"; $content .= "</tr>"; for ($cont = 0; $cont < pg_numrows($resultado); $cont++) { $content .= "<tr>"; $content .= "<td>" . pg_result($resultado, $cont, 0) . "</td>"; $content .= "<td>" . pg_result($resultado, $cont, 1) . "</td>"; $content .= "<td>" . pg_result($resultado, $cont, 2) . "</td>"; $content .= "<td>" . pg_result($resultado, $cont, 3) . "</td>"; $content .= "<td>" . pg_result($resultado, $cont, 4) . "</td>"; $content .= "<td>" . pg_result($resultado, $cont, 5) . "</td>"; $content .= "</tr>"; } $content .= "</table>"; $content .= "</page>"; } else { $content = "<b>No hay registros en la base de datos</b>"; } $html2pdf = new HTML2PDF('P', 'A4', 'es'); //formato del pdf (posicion (P=vertical L=horizontal), tamaño del pdf, lenguaje) $html2pdf->WriteHTML($content); //Lo que tenga content lo pasa a pdf ob_end_clean(); // se limpia nuevamente el buffer $html2pdf->Output('exemple.pdf'); //se genera el pdf, generando por defecto el nombre indicado para guardar }
public function cetak_formulir_pendaftaran_KKM_2016() { ob_start(); $bc['nim'] = $this->session->userdata('nim'); $data['data'] = $this->Daftar_kkm_model->get_by_nim($bc['nim']); $this->load->view('mahasiswa/print', $data); $html = ob_get_contents(); ob_end_clean(); require_once './assets/html2pdf/html2pdf.class.php'; $pdf = new HTML2PDF('P', 'F4', 'en'); $pdf->WriteHTML($html); $pdf->Output('Pendaftaran KKM 2016.pdf', 'fr'); }
public function postApproveinvoice(Request $request) { $approve_id = Input::get('invoice_approve_id'); $post = Input::get(); $i = Invoice::where('Id', $approve_id)->update(array('Status' => $post['approve_status'])); $invoicedata = Invoice::where('Id', $approve_id)->get(); foreach ($invoicedata as $inv) { $email = $inv->ClientEmail; $invno = $inv->InvoiceCode; $clientmail = $inv->ClientName; } if ($i > 0) { $html22 = View('pdfgenerate')->with(array('invoicedata' => $invoicedata))->render(); $html1 = "<h1>adsfadsfasdf</h1>"; require_once app_path() . '/libs/html2pdf/html2pdf.class.php'; $html2pdf = new \HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); // $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($html22); $htmltosend = $html2pdf->Output('', 'S'); $a = 'IDE | Proforma invoice_'; $subject = $a . $invno . $clientmail; Mail::send('emails.invoice', ['Invoice' => 'hgff'], function ($message) use($subject, $htmltosend, $email) { // note: if you don't set this, it will use the defaults from config/mail.php $message->from('*****@*****.**', 'IDE Consulting Services Pvt Ltd'); $message->to($email)->subject($subject)->attachData($htmltosend, 'invoice.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment')); }); $request->session()->flash('alert-success', 'Invoice has been set to client !'); return redirect('home2'); } }
function html2pdf($html, $nombre = "archivo.pdf", $orientacion = "P", $tamanio = "A4", $tituloDocumento = '') { $colegioSessionBean = new ColegioSessionBean(); $fechaActual = obtenerFechaActualFull(); $html = str_replace("\\", "", $html); ob_start(); //include(dirname(__FILE__).'/res/exemple07a.php'); //include(dirname(__FILE__).'/res/exemple07b.php'); echo '<link rel="stylesheet" href="' . PATH_HTTP . 'css/tablas.css" type="text/css" />'; //$html = ereg_replace("\\", "XD", $html); echo '<table> <tr> <td align="center" width="1200"><strong>' . $colegioSessionBean->getNombre() . '</strong> <br/>' . $tituloDocumento . '</td> <td rowspan="2"><img alt="logo" title="logo" src="' . PATH_HTTP . 'images/' . $colegioSessionBean->getColegio_ID() . '/logo.jpg"></td> </tr> </table> <div style="width:1200px; align=right;font-size:8px;">Informe generado el ' . $fechaActual . '</div><br/>'; echo $html; $content = ob_get_clean(); // conversion HTML => PDF //require_once(dirname(__FILE__).'/../html2pdf.class.php'); $html2pdf = new HTML2PDF($orientacion, $tamanio, 'es'); $html2pdf->pdf->SetDisplayMode('fullpage'); //$html2pdf->pdf-> // $html2pdf->pdf->SetProtection(array('print'), 'spipu'); $html2pdf->WriteHTML($content, isset($_GET['vuehtml'])); //echo $content; $html2pdf->Output($nombre); }
protected static function HTML2PDF($html, $fileout) { self::loadLib('/html2pdf/html2pdf.class.php'); $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->WriteHTML($html); return $html2pdf->Output($fileout, 'F'); }
public function convertHtmlToFormat($orientation = 'P') { require_once 'html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF($orientation, 'A4', 'fr'); $html2pdf->setDefaultFont('times'); $html2pdf->WriteHTML($this->docTemplate->render()); $this->doc = $html2pdf->Output(NULL, 'S'); }
/** * @throws HTML2PDF_exception */ public function html2pdf() { $content = "\n\t\t<page>\n\t\t <h1>Exemple d'utilisation</h1>\n\t\t <br>\n\t\t Ceci est un <b>exemple d'utilisation</b>\n\t\t de <a href='http://html2pdf.fr/'>HTML2PDF</a>.<br>\n\t\t</page>"; //require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->WriteHTML(file_get_contents($this->load->view('htmlpdf'))); $html2pdf->Output('exemple.pdf'); }
/** * Recieve the html and generate the pdf * @param string $html */ function setOrderPdf($html, $fileName) { ob_end_clean(); $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(mL, mT, mR, mB)); //$html2pdf->addFont("times"); $html2pdf->WriteHTML($html); $html2pdf->Output($fileName . '.pdf'); die; }
public function cetak() { $npm = $this->session->userdata('npm'); ob_start(); $data['nilai'] = $this->Model_nilai->getNilai($npm); $this->load->view('member/nilai/print', $data); $html = ob_get_contents(); ob_get_clean(); require_once './assets/html2pdf/html2pdf.class.php'; $pdf = new HTML2PDF('P', 'A4', 'en'); $pdf->WriteHTML($html); $pdf->Output('Data Nilai.pdf', 'R'); }
public function viewAction() { $order_id = (int) $this->getRequest()->getParam('order_id'); if (!$order_id || !($order = Mage::getModel('sales/order')->load($order_id))) { $this->_forward('noRoute'); return false; } $standard = Mage::getModel('boleto_ultimate/standard'); if ($standard->isAvailablePrint($order->getStatus())) { try { Mage::register('current_order', $order); $dadosboleto = $standard->prepareValues($order); foreach ($dadosboleto as $key => $value) { $dadosboleto[$key] = utf8_decode($value); } $additional_data = unserialize($order->getPayment()->getAdditionalData()); $code_banco = $additional_data['code_banco']; $path = BP . DS . 'lib' . DS . 'boleto_ultimate' . DS . 'layouts' . DS; ob_start(); require_once $path . 'funcoes_' . $code_banco . '.php'; require_once $path . 'layout_' . $code_banco . '.php'; $content = ob_get_clean(); ob_end_clean(); $html2pdf = new HTML2PDF('P', 'A4', 'pt', false, 'ISO-8859-1', array(15, 5, 5, 8)); $html2pdf->pdf->setFont('arial'); $html2pdf->WriteHTML($content); $html2pdf->Output(time() . '.pdf'); exit; } catch (Exception $e) { Mage::log($order->getIncrementId() . ' => ' . $e->getMessage(), null, 'boleto_ultimate_view.log', true); $this->_forward('noRoute'); return false; } } $this->_forward('noRoute'); return false; }
</TD> <TD WIDTH=208> <P><BR></P> <P ALIGN=CENTER><FONT FACE="Arial, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">- Espacio para timbre o sello del banco - </FONT></FONT> </P> </TD> </TR> </TABLE> </TD> </TR> </TABLE> </page>'; $_SESSION["olvidable"] = 1; $nombre_recibo = "recibos_generados/" . $_POST[cedula] . "_" . $numatricula . ".pdf"; require_once 'librerias/html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'LETTER', 'en'); $html2pdf->WriteHTML($reciboHTML); $html2pdf->Output($nombre_recibo, 'F'); $link = Conectarse(); mysql_select_db("recibos_generados"); //$pdf->Output($nombre_recibo,'F'); $resInsReci = mysql_query("INSERT INTO `recibos` (`id`, `nombre`, `identificacion`, `num_inscripcion`, `programa`, `periodo`, `nivel`, `grupo`, `carne`, `valor`, `archivo`) VALUES (NULL, '" . $nombrecompletoestudiante . "', '" . $_POST[cedula] . "', '" . $numatricula . "', '" . $nombreprograma . "', '" . $recibonumeroperiodo . "', '" . $recibonombrenivel . "', '" . $numerogrupo . "', '" . $recibocarne . "', '" . $valortotal . "', '" . $nombre_recibo . "')", $link); //var_dump($resInsReci); echo "<div><b>" . $nombrecompletoestudiante . " Su recibo se generó adecuadamente, si necesita una copia vaya al link de consulta de recibo.<br>"; echo "<a href=" . $nombre_recibo . ">DESCARGAR RECIBO</a></b><br></div>"; //$pdf->Output(); ?>
} return $sqlStatement; } } /** * This will combine the XML and the XSL * or generate the HTML, Text */ $rg = new ReportGenerator(); $rg->setRequest($_REQUEST); $date = new DateTime(); $Stamp = $date->format('Ymd-His'); $xslt = new XSLTProcessor(); $xslt->registerPHPFunctions(); switch ($rg->format) { case 'html': header('Content-Type: application/xslt+xml'); header('Content-Disposition: inline; filename=' . strtolower($rg->reportDir) . '-' . $Stamp . '".html"'); $xslt->importStylesheet(new SimpleXMLElement($rg->getXSLTemplate())); echo $xslt->transformToXml(new SimpleXMLElement($rg->getXMLDocument())); break; case 'pdf': require_once '../../../lib/html2pdf_v4.03/html2pdf.class.php'; $xslt->importStylesheet(new SimpleXMLElement($rg->getXSLTemplate())); $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->pdf->SetAuthor('GaiaEHR'); $html2pdf->WriteHTML($xslt->transformToXml(new SimpleXMLElement($rg->getXMLDocument()))); $PDFDocument = base64_encode($html2pdf->Output(strtolower($rg->reportDir) . '-' . $Stamp . '.pdf', "S")); echo '<object data="data:application/pdf;base64,' . $PDFDocument . '" type="application/pdf" width="100%" height="100%"></object>'; break; }
require_once '/html2pdf/html2pdf.class.php'; $contenido = "\n\t<div align='center'>\n\t <img src='css/resources/logo.png' height='150'>\n\t <hr>\n\t <h1>Bodega "; $contenido .= $bodega[0]->nombre; $contenido .= "</h1>\n\t <br>\n\t \t<img src='css/resources/bodegas/"; $contenido .= $bodega[0]->path; $contenido .= "\n\t '>\n\t <br>\n\t <br>\n\t <table align='center'>\n\t\t <tr>\n\t\t <td align='right'><strong>Nombre:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->nombre; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Ubicación:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->ubicacion; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Ciudad:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->ciudad; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Estado:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->estado; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>País:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->pais; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Tipo:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->tipo; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Tipo de acceso:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->tipoacceso; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Largo*:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->largo; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Ancho*:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->ancho; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Alto*:</strong></td>\n\t\t <td align='left'>"; $contenido .= $bodega[0]->alto; $contenido .= "</td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td colspan='2'><hr></td>\n\t\t </tr>\n\t\t <tr>\n\t\t <td align='right><strong>Precio**:</strong></td>\n\t\t <td align='left'>"; $contenido .= '$' . number_format($bodega[0]->precio, 2); $contenido .= "</td>\n\t\t </tr>\n\t\t </table>\n \t</div>\n \t<br>\n \t<br>\n \t<div align='left'>\n \t*: Tamaño medido en unidades de metros.<br>\n \t**: Precio mensual en USD.\n \t</div>\n \t<hr>\n \t<p align='center'>Copyright © Grain 2015</p>"; $html2pdf = new HTML2PDF('p', 'A4', 'es'); $html2pdf->WriteHTML($contenido); $html2pdf->Output("detalles.pdf");
$write .= "</tr>"; }*/ $LF = "<br>"; $write = " <style> table{width:800px; height:100%; border:0px; } \n\t\t\t\t\ttd {width:200px;height:100px;margin-top=10px}\n\t\t\t</style>"; $write .= "<table style=''>"; for ($pi = 0; $pi < count($lesParticipants); $pi++) { $write .= "<tr>"; for ($col = 0; $col < 3; $col++) { $p = $lesParticipants[$pi]; $write .= "<td>" . $p["NOMAMIS"] . " " . $p["PRENOMAMIS"] . $LF; $write .= $p["ADRESSEAMIS"] . $LF; $write .= $p["CPAMIS"] . " " . $p["VILLEAMIS"] . $LF; $write .= "</td>"; $pi++; if ($pi >= count($lesParticipants)) { break; } } $pi--; //recalage indice amis $write .= "</tr>"; } $write .= "</table>"; //echo $write; echo utf8_encode($write); $content = ob_get_clean(); require_once "./include" . '/html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->WriteHTML($content); $html2pdf->Output('etiquette_particpants.pdf');
foreach ($habilidades as $habilidad) { $cadena .= "-" . htmlentities($habilidad, ENT_QUOTES, 'UTF-8'); $cadena .= "<br>"; } $cadena .= "</td>\n <td style='border:1px solid #000000; width:100px;' >"; foreach ($inicio as $ini) { $cadena .= "-" . htmlentities($ini, ENT_QUOTES, 'UTF-8'); $cadena .= "<br>"; } $cadena .= "</td>\n\t\n</tr>\n<tr>\n\t<td style='border:1px solid #000000;' bgcolor='#B0C4DE'>\n\t \n </td> \n <td style='border:1px solid #000000;' bgcolor='#B0C4DE'>\n\t Desarrollo\n </td> \n</tr>\n\n<tr>\n\t<td style='border:1px solid #000000;'>\n </td>\n <td style='border:1px solid #000000;'>\n " . htmlentities($desarrollo, ENT_QUOTES, 'UTF-8') . " \n </td>\n</tr>\n\n<tr>\n\t<td style='border:1px solid #000000;' bgcolor='#B0C4DE'>\n\t Fecha:\n </td>\n <td style='border:1px solid #000000;' bgcolor='#B0C4DE'>\t \n </td>\n <td style='border:1px solid #000000;' bgcolor='#B0C4DE'>\n\t Cierre\n </td> \n</tr>\n\n<tr>\n\t<td style='border:1px solid #000000;'>\n " . $fecha . "\t \n </td>\n <td style='border:1px solid #000000;'> \n </td>\n <td style='border:1px solid #000000; width:200px;'>"; foreach ($cierre as $cier) { $cadena .= "-" . htmlentities($cier, ENT_QUOTES, 'UTF-8'); $cadena .= "<br>"; } $cadena .= "</td>\n</tr>\n\n<tr>\n\t<td colspan='3' style='border:1px solid #000000;' bgcolor='#B0C4DE'>\n\t Evaluacion:\n </td> \t\n</tr>\n\n<tr>\n\t<td colspan='3' style='border:1px solid #000000;'>\n " . htmlentities($evaluacion, ENT_QUOTES, 'UTF-8') . "\t\n </td>\n</tr>\n<tr>\n\t<td colspan='2' style='border:1px solid #000000;' bgcolor='#B0C4DE'>\n\t Indicadores:\n </td>\n\t<td colspan='2' style='border:1px solid #000000;' bgcolor='#B0C4DE'>\n\t Actitudes:\n </td>\n</tr>\n<tr>\t\n\t<td colspan='2'style='border:1px solid #000000; width:100px;'>"; foreach ($indicadores as $indicador) { $cadena .= "-" . htmlentities($indicador, ENT_QUOTES, 'UTF-8'); $cadena .= "<br>"; } $cadena .= "</td> \n\t<td colspan='2'style='border:1px solid #000000; width:100px;'>"; foreach ($actitudes as $actitud) { $cadena .= "-" . htmlentities($actitud, ENT_QUOTES, 'UTF-8'); $cadena .= "<br>"; } $cadena .= "</td> \t\n</tr>\n</table>\n</page>"; require_once dirname(__FILE__) . '/html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'A4', 'es'); $html2pdf->WriteHTML($cadena); $html2pdf->Output('Planificacion Clase_' . $numero_clase . '/Semana_' . $numero_semana . '/' . $curso . '/' . $asignatura . '/Unidad' . $unidad . '.pdf', 'D'); ?>
$contenidoPagina .= "<page_header>\r\n <table align='center' style='width: 100%;'>\r\n <tr>\r\n <td align='center' >\r\n <img src='" . $directorio . "css/images/escudo.jpg'>\r\n </td>\r\n <td align='center' >\r\n <font size='18px'><b>UNIVERSIDAD DISTRITAL</b></font>\r\n <br>\r\n <font size='18px'><b>FRANCISCO JOSÉ DE CALDAS</b></font>\r\n <br>\r\n <font size='9px'><b>1948 - 2013 SESENTA Y CINCO AÑOS DE VIDA UNIVERSITARIA</b></font>\r\n </td>\r\n <td align='center' >\r\n <img src='" . $directorio . "css/images/sabio.jpg' width='60'>\r\n </td>\r\n </tr>\r\n </table>\r\n </page_header>\r\n <page_footer>\r\n <table align='center' width = '100%'>\r\n <tr>\r\n <td align='center'>\r\n <img src='" . $directorio . "css/images/escudo.jpg'>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align='center'>\r\n Universidad Distrital Francisco José de Caldas\r\n <br>\r\n Todos los derechos reservados.\r\n <br>\r\n Carrera 8 N. 40-78 Piso 1 / PBX 3238400 - 3239300\r\n <br>\r\n elecciones@udistrital.edu.co \r\n </td>\r\n </tr>\r\n </table>\r\n </page_footer>"; $eleccion = $_REQUEST['eleccion']; $conexion = "estructura"; $esteRecursoDB = $this->miConfigurador->fabricaConexiones->getRecursoDB($conexion); $cadena_sql = $this->sql->cadena_sql("idioma", ''); $resultadoIdioma = $esteRecursoDB->ejecutarAcceso($cadena_sql, "accion"); $cadena_sql = $this->sql->cadena_sql("consultaEleccionFinal", $eleccion); $resultadoEleccion = $esteRecursoDB->ejecutarAcceso($cadena_sql, "busqueda"); $cadena_sql = $this->sql->cadena_sql("consultaCandidatosFinal", $eleccion); $resultadoCandidatos = $esteRecursoDB->ejecutarAcceso($cadena_sql, "busqueda"); $htmlCandidatos = ''; for ($i = 0; $i < count($resultadoCandidatos); $i++) { $htmlCandidatos .= "<tr>"; $htmlCandidatos .= "<td>" . $resultadoCandidatos[$i][0] . "</td>"; $htmlCandidatos .= "<td>" . $resultadoCandidatos[$i][1] . "</td>"; $htmlCandidatos .= "<td>" . $resultadoCandidatos[$i][2] . "</td>"; $htmlCandidatos .= "<td>" . $resultadoCandidatos[$i][3] . "</td>"; $htmlCandidatos .= "<td>" . $resultadoCandidatos[$i][4] . "</td>"; $htmlCandidatos .= "</tr>"; } if ($resultadoEleccion[0][8] == 1) { $segundaClave = "Si"; } else { $segundaClave = "No"; } $contenidoPagina .= "\r\n <table> \r\n <tr>\r\n <td> \r\n <p><h5>Nombre de la Elección: " . $resultadoEleccion[0][0] . "<br>\r\n Descripcion: " . $resultadoEleccion[0][3] . "<br>\r\n Tipo Estamento: " . $resultadoEleccion[0][2] . "<br>\r\n Fecha de Inicio: " . $resultadoEleccion[0][4] . "<br>\r\n Fecha de Finalización: " . $resultadoEleccion[0][5] . "<br>\r\n Tipo de Votación: " . $resultadoEleccion[0][7] . "<br>\r\n Segunda Clave: " . $segundaClave . "</h5></p>\r\n </td>\r\n </tr>\r\n <tr> \r\n <td>\r\n <table>\r\n <tr>\r\n <th>Lista</th>\r\n <th>Posicion</th>\r\n <th>Identificación</th>\r\n <th>Nombres</th>\r\n <th>Apellidos</th>\r\n </tr>\r\n " . $htmlCandidatos . "\r\n </table>\r\n </td>\r\n </tr>\r\n </table>\r\n "; $contenidoPagina .= "</page>"; $html2pdf = new HTML2PDF('P', 'LETTER', 'es'); $res = $html2pdf->WriteHTML($contenidoPagina); $html2pdf->Output('resumenProceso.pdf', 'D'); //$html2pdf->Output('certificado.pdf');
function html2pdf($content, $subject = NULL, $title = NULL, $type = NULL, $id = NULL, $orientation = 'P', $margins = array(5, 10, 5, 10), $save = false, $copy = false) { global $layout, $DB; require_once LIB_DIR . '/html2pdf/html2pdf.class.php'; if (isset($margins)) { if (!is_array($margins)) { $margins = array(5, 10, 5, 10); } } /* default */ $html2pdf = new HTML2PDF($orientation, 'A4', 'en', true, 'UTF-8', $margins); /* disable font subsetting to improve performance */ $html2pdf->pdf->setFontSubsetting(false); if ($id) { $info = $DB->GetRow('SELECT di.name, di.description FROM divisions di LEFT JOIN documents d ON (d.divisionid = di.id) WHERE d.id = ?', array($id)); } $html2pdf->pdf->SetProducer('LMS Developers'); $html2pdf->pdf->SetCreator('LMS ' . $layout['lmsv']); if ($info) { $html2pdf->pdf->SetAuthor($info['name']); } if ($subject) { $html2pdf->pdf->SetSubject($subject); } if ($title) { $html2pdf->pdf->SetTitle($title); } $html2pdf->pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone'); $html2pdf->AddFont('arial', '', 'arial.php'); $html2pdf->AddFont('arial', 'B', 'arialb.php'); $html2pdf->AddFont('arial', 'I', 'ariali.php'); $html2pdf->AddFont('arial', 'BI', 'arialbi.php'); $html2pdf->AddFont('times', '', 'times.php'); /* if tidy extension is loaded we repair html content */ if (extension_loaded('tidy')) { $config = array('indent' => true, 'output-html' => true, 'indent-spaces' => 4, 'join-styles' => true, 'join-classes' => true, 'fix-bad-comments' => true, 'fix-backslash' => true, 'repeated-attributes' => 'keep-last', 'drop-proprietary-attribute' => true, 'sort-attributes' => 'alpha', 'hide-comments' => true, 'new-blocklevel-tags' => 'page, page_header, page_footer, barcode', 'wrap' => 200); $tidy = new tidy(); $content = $tidy->repairString($content, $config, 'utf8'); } $html2pdf->WriteHTML($content); if ($copy) { /* add watermark only for contract & annex */ if ($type == DOC_CONTRACT || $type == DOC_ANNEX) { $html2pdf->AddFont('courier', '', 'courier.php'); $html2pdf->AddFont('courier', 'B', 'courierb.php'); $html2pdf->pdf->SetTextColor(255, 0, 0); $PageWidth = $html2pdf->pdf->getPageWidth(); $PageHeight = $html2pdf->pdf->getPageHeight(); $PageCount = $html2pdf->pdf->getNumPages(); $txt = trim(preg_replace("/(.)/i", "\${1} ", trans('COPY'))); $w = $html2pdf->pdf->getStringWidth($txt, 'courier', 'B', 120); $x = $PageWidth / 2 - $w / 2 * sin(45); $y = $PageHeight / 2 + 50; for ($i = 1; $i <= $PageCount; $i++) { $html2pdf->pdf->setPage($i); $html2pdf->pdf->SetAlpha(0.2); $html2pdf->pdf->SetFont('courier', 'B', 120); $html2pdf->pdf->StartTransform(); $html2pdf->pdf->Rotate(45, $x, $y); $html2pdf->pdf->Text($x, $y, $txt); $html2pdf->pdf->StopTransform(); } $html2pdf->pdf->SetAlpha(1); } } if ($type == DOC_CONTRACT || $type == DOC_ANNEX) { /* set signature additional information */ $info = array('Name' => $info['name'], 'Location' => $subject, 'Reason' => $title, 'ContactInfo' => $info['description']); /* setup your cert & key file */ $cert = 'file://' . LIB_DIR . '/tcpdf/config/lms.cert'; $key = 'file://' . LIB_DIR . '/tcpdf/config/lms.key'; /* set document digital signature & protection */ if (file_exists($cert) && file_exists($key)) { $html2pdf->pdf->setSignature($cert, $key, 'lms-documents', '', 1, $info); } } $html2pdf->pdf->SetProtection(array('modify', 'annot-forms', 'fill-forms', 'extract', 'assemble'), '', PASSWORD_CHANGEME, '1'); if ($save) { if (function_exists('mb_convert_encoding')) { $filename = mb_convert_encoding($title, "ISO-8859-2", "UTF-8"); } else { $filename = iconv("UTF-8", "ISO-8859-2//TRANSLIT", $title); } $html2pdf->Output($filename . '.pdf', 'D'); } else { $html2pdf->Output(); } }
function generateUpdatedInvoice($invoice_type_id, $invoiceid, $user_id) { ob_clean(); //echo $invoice_id; global $wpdb; /* get form type to display in correct pdf format */ $form_type = $wpdb->get_var($wpdb->prepare("SELECT form_type FROM wp_invoice_type WHERE invoice_type_id = %d", $invoice_type_id)); $form_name = $wpdb->get_var($wpdb->prepare("SELECT invoice_name FROM wp_invoice_type WHERE invoice_type_id = %d", $invoice_type_id)); /* $user_id = $_POST["user-id"]; if ($_POST["others_behalf"]) { $user_email = $_POST["email"]; $user_id = $wpdb->get_var($wpdb->prepare("SELECT `ID` FROM `wp_users` WHERE `user_email` = %s;", $user_email)); } // if on other's behalf, get id of person*/ $invoiceNameRow = $wpdb->get_row($wpdb->prepare("SELECT * FROM `wp_invoice_type` WHERE `invoice_type_id` = %d;", $invoice_type_id)); $invoiceName = $invoiceNameRow->invoice_name; $subdateRow = $wpdb->get_row($wpdb->prepare("SELECT * FROM `wp_invoice_table` WHERE `invoice_no` = %d;", $invoiceid)); $subdate = $subdateRow->invoice_creation_date; $single = true; $key = 'last_name'; $user_last = get_user_meta($user_id, $key, $single); $key = 'first_name'; $user_first = get_user_meta($user_id, $key, $single); $name = $user_first . ' ' . $user_last; $key = 'wp_school_id'; $schoolid = get_user_meta($user_id, $key, $single); $key = 'wp_school'; $school = get_user_meta($user_id, $key, $single); $key = 'wp_district'; $district = get_user_meta($user_id, $key, $single); $key = 'wp_county'; $county = get_user_meta($user_id, $key, $single); $key = 'wp_school_address'; $schooladdr = get_user_meta($user_id, $key, $single); $key = 'wp_school_city'; $schoolcity = get_user_meta($user_id, $key, $single); $key = 'wp_school_state'; $schoolstate = get_user_meta($user_id, $key, $single); $key = 'wp_school_zipcode'; $schoolzip = get_user_meta($user_id, $key, $single); $key = 'wp_school_phone_number'; $schoolphone = get_user_meta($user_id, $key, $single); $key = 'wp_phone_number'; $phone = get_user_meta($user_id, $key, $single); $school1 = ' ' . $school; $schooladdr1 = ' ' . $schooladdr; $schoolcsz1 = ' ' . $schoolcity . ', ' . $schoolstate . ' ' . $schoolzip; $user_info = get_userdata($user_id); $email = $user_info->user_email; if ($invoice_type_id == 17) { $name = $wpdb->get_var($wpdb->prepare("SELECT `field_value` FROM `wp_invoice_data` WHERE `invoice_no` = %d AND `field_name` = 'nameInfo'", $invoiceid)); $email = $wpdb->get_var($wpdb->prepare("SELECT `field_value` FROM `wp_invoice_data` WHERE `invoice_no` = %d AND `field_name` = 'email_address'", $invoiceid)); } /* ***** BEGIN PDF Page Generation ***** */ ob_start(); switch ($form_type) { case "invoice": include 'templates/pdf_generation/invoice.php'; break; default: include 'templates/pdf_generation/report.php'; break; } // switch: PDF Display format if ($invoice_type_id == 14) { echo '<br/><span style="font-weight:bold">For more information regarding the summer institute, please visit our ' . '<a href="http://c-stem.ucdavis.edu/teachers-administrators/professional-development/2015-2016/summer-institute-2015/">2015 Summer Institute</a> page</span>'; } // 2015 Summer Institute //ob_clean(); $content = ob_get_clean(); //echo $content; $form_name = str_replace(' ', '_', $form_name); $file_name = $form_name . '_' . $invoiceid . '.pdf'; /* switch ($invoice_type_id) { case 8: $file_name = 'Application_' . $invoiceid . '.pdf'; break; case 13: // Tech Support $file_name = 'Support_' . $invoiceid . '.pdf'; break; default: $file_name = 'Quote_' . $invoiceid . '.pdf'; break; } // switch: File Name*/ $file_path = '/var/www/wordpress/wp-content/invoice_files/' . $file_name; require_once ABSPATH . 'wp-content/plugins/html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->WriteHTML($content); ob_clean(); $result = $html2pdf->Output($file_path, 'F'); echo $result; header("Content-type:application/pdf"); echo file_get_contents($file_path); /* ***** END PDF Page Generation ***** */ }
function cetak_kartu_ujian($id) { $session = $this->login->logged(); if ($session->level != 'admin') { redirect('login'); } else { ob_start(); $data['session'] = $session; $this->db->where('ID_peserta', $id); $query = $this->db->get('tb_peserta'); //$dynamic_title = $query->row(); $data['deco'] = $id; $data['deconama'] = $nama; $data['detail'] = $query->row(); $this->load->view('admin/content/cetak_kartu_ujian', $data); $html = ob_get_contents(); ob_end_clean(); require_once './assets/html2pdf/html2pdf.class.php'; $pdf = new HTML2PDF('P', 'A4', 'en'); $pdf->WriteHTML($html); $pdf->Output('KartuUjian.pdf', 'D'); } }
function testPdf() { $content = "\n\t\t<page>\n\t\t\t<h1>Exemple d'utilisation</h1>\n\t\t\t<br>\n\t\t\tCeci est un <b>exemple d'utilisation</b>\n\t\t\tde <a href='http://html2pdf.fr/'>HTML2PDF</a>.<br>\n\t\t</page>"; require_once 'html2pdf.class.php'; die('fghfgh'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->WriteHTML($content); if ($html2pdf->Output(JPATH_BASE . DIRECTORY_SEPARATOR . 'exemple.pdf')) { die('ok'); } else { die('fail'); } }
<?php /** * Logiciel : exemple d'utilisation de HTML2PDF * * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY * Distribué sous la licence LGPL. * * @author Laurent MINGUET <*****@*****.**> * * isset($_GET['vuehtml']) n'est pas obligatoire * il permet juste d'afficher le résultat au format HTML * si le paramètre 'vuehtml' est passé en paramètre _GET */ // récupération du contenu HTML ob_start(); include dirname(__FILE__) . '/res/exemple04.php'; $content = ob_get_clean(); // conversion HTML => PDF require_once dirname(__FILE__) . '/../html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('exemple04.pdf');
<td><?php echo $row['Date/Heure d\'ouverture']; ?> </td> <td><?php echo $row['Date/Heure de clôture']; ?> </td> <td><?php echo $row['duree']; ?> </td> </tr> <?php } ?> </table> </page> <?php $content = ob_get_clean(); require 'html2pdf/html2pdf.class.php'; $pdf = new HTML2PDF('L', 'A3', 'fr', 'true', 'utf-8'); $pdf->WriteHTML($content); ob_end_clean(); $pdf->Output(); ?>
function exportHTML2PDF($orientation, $pageFormats, $baseImgPath, $header = '') { ob_start(); ?> <style type="text/css"> .gt-table { border: solid 0px #000000; border-left:1px; border-top:1px; width: 50%; } .gt-table th { background-color: #eeeeee; border-right:1px; border-bottom:1px; } .gt-table td { border-right:1px; border-bottom:1px; } .gt-inner { width: 50%; } .gt-inner-right { text-align : right; } </style> <?php $template_style = ob_get_clean(); $_pageD = '10mm'; $tableHTML = getParameter('__gt_html'); //$headS = strpos($tableHTML, '<!-- gt : head start -->')+strlen('<!-- gt : head start -->'); $headE = strpos($tableHTML, '<!-- gt : head end -->') + strlen('<!-- gt : head end -->'); $tableStartHTML = substr($tableHTML, 0, $headE); /* PUNTO DE ENTRADA PARA AGREGAR MAS HTML */ $tableHTML = $header . str_replace('.gt-grid ', '', $tableHTML); $tableHTML = str_replace('<!-- gt : page separator -->', '</tbody></table></page><page backtop="' . $_pageD . '" backbottom="' . $_pageD . '">' . $tableStartHTML . '<tbody>', $tableHTML); //debug ( $template_style ); //debug ("----------------\n"); //debug ( $tableHTML ); //////////////////////////////////////////////////////////////////////// //begin !!the following lines exist for enhance exporting performance //////////////////////////////////////////////////////////////////////// preg_match_all('/\\.([a-z0-9_\\-]+)\\s+\\{(.*?)display:none;(.*?)\\}/', $tableHTML, $result, PREG_SET_ORDER); $patternArray = array(); $replaceArray = array(); for ($matchi = 0; $matchi < count($result); $matchi++) { $patternArray[$matchi] = '/<td\\s+class="([a-z0-9_\\-]+\\s+)*' . $result[$matchi][1] . '(\\s+[a-z0-9_\\-]+)*\\s*"[^>]*>(.*?)<\\/td>/'; //debug($patternArray[$matchi] ."\n"); $replaceArray[$matchi] = ''; } $tableHTML = preg_replace($patternArray, $replaceArray, $tableHTML); //////////////////////////////////////////////////////////////////////// //end !! //////////////////////////////////////////////////////////////////////// //debug ("----------------\n"); //debug ( $tableHTML ); $page_content = '<page backtop="' . $_pageD . '" backbottom="' . $_pageD . '">' . $template_style . $tableHTML . '</page>'; $pdf = new HTML2PDF($orientation, $pageFormats, 'en', false, $baseImgPath); $pdf->WriteHTML($page_content, false); $pdf->pdf->Output($this->exportFileName . '.pdf', 'D'); }
public function save($file) { $pdfs = array(); foreach ($this->_html as $i => $page) { $f = '/tmp/' . Athem_Utils::randString(10); $pdf = new HTML2PDF($this->_getOrientation(), $this->_getSize(), 'en'); $pdf->WriteHTML($page); $pdf->Output("{$f}.pdf", 'F'); $pdfs[] = "{$f}.pdf"; } $pdfMerge = Athem_Pdf_Merge_Abstract::factory($this->_page['merge'], $pdfs); $pdfMerge->save($file); }
public function render($file = NULL) { $html = parent::render($file); $html2pdf = new HTML2PDF('P', 'A4', $this->_langue); $html2pdf->pdf->SetAuthor($this->_author); $html2pdf->pdf->SetTitle($this->_title); $html2pdf->pdf->SetSubject($this->_subject); $html2pdf->pdf->SetKeywords($this->_keywords); $html2pdf->WriteHTML($html); $html2pdf->Output('public/pdf/' . $this->_name, 'F'); }
public function actionPendidikans() { $html2pdf = Yii::app()->ePdf->html2pdf('L', 'A4', 'en', false, 'ISO-8859-15', array(10, 5, 10, 5)); $html2pdf->pdf->SetDisplayMode('fullpage'); $dosen = Yii::app()->request->getParam('id_dosen', 0); $pj = Yii::app()->request->getParam('pengajuan', 0); $sql = "select unsur_pendidikan.ID_UNSUR_PEND,subun_pend.SUBUNPEND,tbl_dosen.NAMA_DOSEN, tbl_dosen.NIP_DOSEN, \n tbl_jabatan.NAMA_JABATAN, tbl_golongan.GOLONGAN, tbl_golongan.PANGKAT, tbl_jurusan.NAMA_JURUSAN, \n tbl_jurusan.NAMA_PIMPINAN, tbl_jurusan.NIP_PIMPINAN, tbl_jurusan.PANGKAT AS PJ, tbl_jurusan.GOLONGAN AS GJ, tbl_fakultas.NAMA_FAKULTAS, \n unsur_pendidikan.KEGIATAN_PENDIDIKAN, unsur_pendidikan.TEMPAT_PENDIDIKAN, \n unsur_pendidikan.TGL_KEGIATAN_PEND, unsur_pendidikan.NILAI_PENDIDIKAN, \n unsur_pendidikan.BUKTI_PENDIDIKAN, unsur_pendidikan.PENGAJUAN_KE \n from unsur_pendidikan inner join subun_pend on \n unsur_pendidikan.ID_SUBUNPEND=subun_pend.ID_SUBUNPEND join tbl_dosen \n on unsur_pendidikan.ID_DOSEN=tbl_dosen.ID_DOSEN join tbl_jabatan on \n tbl_dosen.ID_JABATAN=tbl_jabatan.ID_JABATAN join tbl_golongan on \n tbl_dosen.ID_GOLONGAN=tbl_golongan.ID_GOLONGAN join tbl_jurusan on \n tbl_dosen.ID_JURUSAN=tbl_jurusan.ID_JURUSAN join tbl_fakultas on \n tbl_jurusan.ID_FAKULTAS=tbl_fakultas.ID_FAKULTAS where \n unsur_pendidikan.ID_DOSEN='{$dosen}' and unsur_pendidikan.PENGAJUAN_KE='{$pj}' "; $data = Yii::app()->db->createCommand($sql)->queryAll(); $content = $this->renderPartial('pendidikans', array('data' => $data), true); $html2pdf = new HTML2PDF('L', 'A4', 'en', array(10, 5, 10, 5)); $html2pdf->WriteHTML($content); $html2pdf->Output(); }
public function printInvoice($id) { $data = $this->payment_model->get($id); if (!$data) { echo "Not data"; die; } else { //echo $id; $this->template = new View('admin_invoice/invoice', true); $this->template->set(array('test' => $this->test_model->get($data['test_uid']), 'member' => $this->member_model->get($data['member_uid']), 'mr' => $data)); require Kohana::find_file('vendor/html2pdf', 'html2pdf'); $html2pdf = new HTML2PDF(); //$html2pdf->HTML2PDF('L','A4', 'en', array(10, 10, 10, 10)); $html2pdf->HTML2PDF('P', 'letter', 'en', array(10, 10, 10, 10)); $html2pdf->WriteHTML($this->template, false); echo $html2pdf->Output('Sales_Order_' . $data['uid'] . '.pdf'); } }