function crear_certificado($parametros) { $pdf = new PDF_HTML('L', 'mm', 'Letter', 20, 7); $pdf->AddPage(); $pdf->SetlineWidth(0.264583333); $pdf->setDrawColor(74, 112, 139); $pdf->Rect(17.018, 4.318, $pdf->w - 17.018 - 17.018, $pdf->h - 4.318 - 4.318); $pdf->SetFont('Arial', '', 12); // IMAGENES // QR $url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" . "status_chofer.php"; $qrFile = generarQR($url); $pdf->Image($qrFile, 18, 8, 0, 30, 'PNG'); unlink($qrFile); $pdf->Image(__DIR__ . '/../img/logo2.png', 235, 8, 0, 30); $pdf->Image(__DIR__ . '/../img/logo.png', 105, 8, 0, 30); $pdf->Ln(15); // TITULO $title = '<p align="center"><b><u>CERTIFICADO DE CAPACITACIÓN PARA EL TRANSPORTE DE MERCANCÍAS PELIGROSAS</u></b></p>'; $pdf->WriteHTML(utf8_decode($title)); // BLOQUE 1 $htmlprev = <<<'EOD' El Prestador de Servicios de Formación Profesional para la Capacitación Básica y Complementaria Obligatoria de los Conductores de Vehículos Empleados en el Transporte de Mercancías Peligrosas por Carretera, <b>#PRESTADOR</b>, certifica que el/la <b>#CHOFER</b>, Matricula <b>#MATRICULA</b>, DNI <b>#DNI</b>, ha participado y completado el curso de Capacitación <b>#CURSO</b> según Resolución S.T N° 110/1997 modificada por Resolución S.T. N° 65/2000 para los Conductores de los Vehículos antes mencionados. EOD; $holders = ["#PRESTADOR", "#CHOFER", "#MATRICULA", "#DNI", "#CURSO"]; $variables = [utf8_decode($parametros['prestador']), utf8_decode($parametros['chofer']), utf8_decode($parametros['matricula']), utf8_decode($parametros['dni']), utf8_decode($parametros['curso'])]; $html = str_replace($holders, $variables, utf8_decode($htmlprev)); $pdf->WriteHTML($html); $pdf->Ln(20); // BLOQUE 2 $html = <<<'EOD' Se expide el presente Certificado, a los efectos de la obtención de la Licencia Nacional habilitante. La vigencia del mismo es de UN (1) año a partir de la fecha de realización del Curso de Capacitación. EOD; $pdf->WriteHTML(utf8_decode($html)); $pdf->Ln(20); // FECHAS $texto = 'Sede del Curso: '; $pdf->Cell(50, 5, utf8_decode($texto), 0, 0, 'L'); $pdf->setFont('Arial', 'B', 12); $pdf->Cell(100, 5, utf8_decode($parametros['sede']), 0, 0, 'L'); $pdf->setFont('Arial', '', 12); $texto = 'Fecha del Curso: '; $pdf->Cell(10, 5, '', 0, 0, 'L'); $pdf->Cell(0, 5, $texto, 0, 0, 'L'); $pdf->setFont('Arial', 'B', 12); $pdf->Cell(0, 5, utf8_decode($parametros['fecha_curso']), 0, 1, 'R'); $pdf->setFont('Arial', '', 12); $pdf->Ln(5); $texto = 'Numero de Transacción: '; $pdf->Cell(50, 5, utf8_decode($texto), 0, 0, 'L'); $pdf->setFont('Arial', 'B', 12); $pdf->Cell(100, 5, utf8_decode($parametros['transaccion']), 0, 0, 'L'); $pdf->setFont('Arial', '', 12); $texto = 'Fecha de Transacción: '; $pdf->Cell(10, 5, '', 0, 0, 'L'); $pdf->Cell(0, 5, utf8_decode($texto), 0, 0, 'L'); $pdf->setFont('Arial', 'B', 12); $pdf->Cell(0, 5, utf8_decode($parametros['fecha_transaccion']), 0, 1, 'R'); $pdf->setFont('Arial', '', 12); $pdf->Ln(45); return $pdf; }
<?php $total = $_POST['total']; $name = $_POST['NameChild']; $date = $_POST['DateChild']; $t = time(); $day = date("Y-m-d", $t); $pdfname = $name . $day . ".txt"; $pdf = new PDF_HTML(); $pdf->AliasNbPages(); $pdf->SetAutoPageBreak(true, 20); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 20); $pdf->WriteHTML('<para><h1>PATIENT HEALTH QUESTIONAIRE: PHQ-A <em><br><br>(adolescent 2-17 years old)</em></h1><br></para>'); $pdf->SetFont('Arial', '', 18); $htmlTable1 = ' <TABLE> <TR> <br> <br> <TD>Name:' . $_POST['NameChild'] . '<br><br></TD> <TD>Date:' . $_POST['DateChild'] . '<br><br><br><br></TD> </TR> </TABLE> <br> <pre> <br> 1.Feeling down or depressed or hopeless-' . $_POST['Q1'] . '<br><br> 2.Little interest or pleasure in doing things-' . $_POST['Q2'] . '<br><br> 3. Trouble falling or staying asleep, or sleeping too much-' . $_POST['Q3'] . '<br><br> 4. Feeling tired or having little energy-' . $_POST['Q4'] . '<br><br>
if (strstr($perfis_usuario, $perfil)) { require_once "{$caminho}/../certificado/lib/write_html.php"; $nome_arquivo = "Certificado " . NOME_EVENTO . " {$perfil} " . Funcoes::remove_acentos(utf8_encode($nome)) . ".pdf"; $nome_arquivo = strtolower(str_replace(" ", "_", $nome_arquivo)); $arquivo_destino = "{$caminho}/../temp/{$nome_arquivo}"; $pdf = new PDF_HTML(); $pdf->AddPage('L'); $pdf->setSourceFile($modelo); $tplIdx = $pdf->importPage(1); $pdf->useTemplate($tplIdx); $palestra = $perfil == "palestrante" ? ', com o tema "' . utf8_encode($tema_palestra) . '"' : ""; $nome_convertido = utf8_encode($nome); $titulo = "CERTIFICADO"; $corpo = utf8_decode("Certificamos que <b>{$nome_convertido}</b> participou do evento " . NOME_EVENTO . ", realizado " . PERIODO_EVENTO . ", " . LOCAL_EVENTO . ", com carga horária de " . CARGA_HORARIA_EVENTO . " horas, na qualidade de <b>{$perfil}</b>{$palestra}."); // Titulo $pdf->SetFont('Arial', 'B', 32); $pdf->SetTextColor(35, 142, 35); //Verde Floresta $pdf->SetXY(110, 35); $pdf->Write(0, $titulo); // Corpo do texto $pdf->SetFont('Arial', '', 22); $pdf->SetTextColor(35, 142, 35); //Verde Floresta $pdf->SetY("65"); $pdf->SetX("20"); $pdf->WriteHTML($corpo, 9); $pdf->Output($arquivo_destino, 'F'); $retorno = EnviarEmail::enviar("envio_certificado", "", $email, $nome, 0, "", $arquivo_destino); if (file_exists($arquivo_destino)) { unlink($arquivo_destino);
<?php require 'WriteHTML.php'; $pdf = new PDF_HTML(); $pdf->AliasNbPages(); $pdf->SetAutoPageBreak(true, 15); $pdf->AddPage(); $pdf->Image('logo.png', 18, 13, 33); $pdf->SetFont('Arial', 'B', 14); $pdf->WriteHTML('<para><h1>PHPGang Programming Blog, Tutorials, jQuery, Ajax, PHP, MySQL and Demos</h1><br> Website: <u>www.phpgang.com</u></para><br><br>How to Convert HTML to PDF with fpdf example'); $pdf->SetFont('Arial', 'B', 7); $htmlTable = '<TABLE> <TR> <TD>Name:</TD> <TD>' . $_POST['name'] . '</TD> </TR> <TR> <TD>Email:</TD> <TD>' . $_POST['email'] . '</TD> </TR> <TR> <TD>URl:</TD> <TD>' . $_POST['url'] . '</TD> </TR> <TR> <TD>Comment:</TD> <TD>' . $_POST['comment'] . '</TD> </TR> </TABLE>'; $pdf->WriteHTML2("<br><br><br>{$htmlTable}");
function leerdoc($documento) { //require('fpdf/fpdf.php'); require_once 'rtf2html.php'; require_once 'aux_pdf.php'; $reader = new RtfReader(); $rtf = file_get_contents("{$documento}"); // or use a string $reader->Parse($rtf); $formatter = new RtfHtml(); $pdf = new PDF_HTML(); $pdf->SetFont('Arial', '', 12); $pdf->AddPage(); $text = $formatter->Format($reader->root); if (ini_get('magic_quotes_gpc') == '1') { $text = stripslashes($text); } $pdf->WriteHTML($text); $pdf->Output(); exit; }
<?php require ('WriteHTML.php'); $pdf = new PDF_HTML (); $pdf->AddPage (); $pdf->SetFont ( 'Arial' ); $html1 = 'Default <font face="courier">Courier <font face="helvetica">Helvetica <font face="times">Times <font face="dejavusans">dejavusans </font>Times </font>Helvetica </font>Courier </font>Default'; $html2 = '<small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal'; $html3 = "<font size='10' color='#ff7f50'>The</font> <font size='10' color='#6495ed'>quick</font> <font size='14' color='#dc143c'>brown</font> <font size='18' color='#008000'>fox</font> <font size='22'><a href='http://www.tcpdf.org'>jumps</a></font> <font size='22' color='#a0522d'>over</font> <font size='18' color='#da70d6'>the</font> <font size='14' color='#9400d3'>lazy</font> <font size='10' color='#4169el'>dog</font>."; $html = $html1 . '<br>' . $html2 . '<br>' . $html3 . '<br>' . $html3 . '<br>' . $html2; // output the HTML content $pdf->writeHTML ( $html, true, false, true, false, '' ); $pdf->Output ( 'materia-PDF.pdf', 'I' ); ?>
// $ourPDF->SetDrawColor(255, 255, 255); $ourPDF->multiCell($largeur_page - $marge_page_droite - $ourPDF->GetX(), 6, $msg["tache_heure_dern_exec"] . " : " . $task_datas['start_at'][1] . "\n", 0, 'L', 0); // $ourPDF->SetDrawColor(127, 127, 127); $ourPDF->multiCell($largeur_page - $marge_page_droite - $ourPDF->GetX(), 6, $msg["tache_date_fin_exec"] . " : " . formatdate($task_datas['end_at'][0]) . "\n", 0, 'L', 0); // $ourPDF->SetDrawColor(255, 255, 255); $ourPDF->multiCell($largeur_page - $marge_page_droite - $ourPDF->GetX(), 6, $msg["tache_heure_fin_exec"] . " : " . $task_datas['end_at'][1] . "\n", 0, 'L', 0); // $ourPDF->SetDrawColor(127, 127, 127); $ourPDF->multiCell($largeur_page - $marge_page_droite - $ourPDF->GetX(), 6, $msg["tache_statut"] . " : " . $msg["planificateur_state_" . $task_datas["status"]] . " (" . $task_datas["indicat_progress"] . "%)\n", 0, 'L', 0); // $ourPDF->SetDrawColor(255, 255, 255); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $ourPDF->GetX()), 6, $header, 0, 'L', 0); $ourPDF->SetXY(15, 70); $ourPDF->multiCell($largeur_page - $marge_page_droite - $ourPDF->GetX(), 8, $msg["tache_report_execution"], 0, 'L', 0); $report_execution = $conn->show_report($task_datas["rapport"]); // $ourPDF = new PDF_HTML(); // $ourPDF->AddPage(); $ourPDF->SetFont('Arial'); $ourPDF->WriteHTML($report_execution); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["planificateur_task_name"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["tache_date_generation"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["tache_date_dern_exec"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["tache_heure_dern_exec"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["tache_date_fin_exec"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["tache_heure_fin_exec"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["tache_statut"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $msg["tache_report_execution"], 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $task_datas["id_tache"], 0, 'L', 0); // $ourPDF->SetXY (75,8); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, stripslashes($task_datas["libelle_tache"]), 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, formatdate($date_MySQL), 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, formatdate($task_datas['start_at'][0]), 0, 'L', 0); // $ourPDF->multiCell(($largeur_page - $marge_page_droite - $marge_page_gauche), 8, $task_datas['start_at'][1], 0, 'L', 0);
$sql_customer = "SELECT * from sale natural join cart"; $res_customer = $conn->query($sql_customer); $row_customer = $res_customer->fetch_assoc(); $customer_name = $row_customer['customer_name']; $customer_phone = $row_customer['customer_phone']; //generating pdf file //$pdf = new FPDF(); $pdf = new PDF_HTML(); $pdf->AddPage(); $pdf->SetFillColor(0, 102, 0); ////// logo $size = "60"; $absx = (210 - $size) / 2; $pdf->Image('../image/hello_cash.jpg', $absx, 5, $size); /// $pdf->SetFont('Arial', 'B', 10); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(0, 10, '', 0, 1); $pdf->Cell(0, 10, '', 0, 1); // empty space $pdf->Cell(0, 5, '', 0, 1); $pdf->Cell(0, 10, 'Shop No. 441, Orchard Point, Mirpur Road, Dhanmondi-7, Dhaka.', 0, 1, "C"); $pdf->Cell(0, 0, 'Cell: +8801977677776, +8801717050090', 0, 1, "C"); $pdf->Image('../image/fblogo.png', $pdf->GetX() + 60, $pdf->GetY() + 2, 5); $pdf->Cell(0, 10, 'www.facebook.com/Helloelectronix', 0, 1, "C"); $pdf->Cell(0, 0, '', 0, 1); // empty space $pdf->SetTextColor(0, 0, 100); $pdf->SetFont('Arial', 'B', 14); $pdf->WriteHTML('<p><b>Bill To :</b></p><br>'); $pdf->SetFont('Arial', 'B', 14);
// $pdf->SetX((210-$w)/2); // $pdf->Cell($w,2,$titre2,0,1,'C',false); $pdf->Output('../sauvegarde/animaux/' . $_POST['animal_id'] . '/euthanasie_' . $variable . '.pdf', F); echo json_encode($variable); } elseif ($_GET['action'] == 'autre_certif') { $filename = '../sauvegarde/animaux/' . $_POST['animal_id']; $variable = round(microtime(true)); //$info_client = json_decode($info_client, true); if (!file_exists($filename)) { if (!mkdir($filename, 0755, true)) { die('Echec lors de la création des répertoires...'); } } $pdf = new PDF_HTML(); $pdf->AddPage(); $pdf->SetFont('Times', '', 12); $pdf->WriteHTML(utf8_decode(stripslashes($_POST['message']))); $pdf->Output('../sauvegarde/animaux/' . $_POST['animal_id'] . '/certificat_' . $variable . '.pdf', F); echo json_encode($variable); } elseif ($_GET['action'] == 'drop_client_animal') { $info_client = $_POST['client']; $sql = " CREATE TEMPORARY TABLE tmptable_1 SELECT * FROM client WHERE id2 = :clien_id;\r\n\tUPDATE tmptable_1 SET id2 = NULL, permission2=:permission;\t\r\n\tINSERT INTO client SELECT * FROM tmptable_1;\r\n\tDROP TEMPORARY TABLE IF EXISTS tmptable_1;"; $st2 = $db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $st2->execute(array(':clien_id' => $info_client[0]['id2'], ':permission' => $_SESSION['login'])); $st2->closeCursor(); $sql = " CREATE TEMPORARY TABLE tmptable_2 SELECT * FROM animal WHERE id = :animal_id;\r\n\tUPDATE tmptable_2 SET id = NULL, permission=:permission ;\t\r\n\tINSERT INTO animal SELECT * FROM tmptable_2;\r\n\tDROP TEMPORARY TABLE IF EXISTS tmptable_2;"; $st2 = $db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $st2->execute(array(':animal_id' => $_POST['animal_id'], ':permission' => $_SESSION['login'])); $st2->closeCursor(); $sql = "SELECT * FROM client ORDER BY id2 DESC LIMIT 1"; $st2 = $db->prepare($sql);
<?php require 'html2pdf.php'; if (isset($_POST['text'])) { $pdf = new PDF_HTML(); $pdf->SetFont('Arial', '', 12); $pdf->AddPage(); $text = $_POST['text']; if (ini_get('magic_quotes_gpc') == '1') { $text = stripslashes($text); } $pdf->WriteHTML($text); $pdf->Output(); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>HTML2PDF</title> <style type="text/css"> input, textarea { font-family: lucida console; font-size: 9pt; border: 1px solid #B0B0B0; } body { font-family: lucida console; font-size: 9pt; background-color: #F0F0F0; }
function exportBannette($id_bannette) { global $msg, $PMBusername; global $ourPDF; if (SESSrights & DSI_AUTH) { if (!$id_bannette) { throw new Exception("Missing parameter: id_bannette"); } $bannette = new bannette($id_bannette); // $action_diff_aff .= "<strong>".$msg['dsi_dif_export'].": ".$bannette->nom_bannette."</strong><br />" ; // $ourPDF = $bannette->construit_contenu_PDF(); $resultat_html = $bannette->construit_contenu_HTML(); $ourPDF = new PDF_HTML(); $ourPDF->AddPage(); $ourPDF->SetFont('Arial'); $ourPDF->WriteHTML($resultat_html); return $ourPDF; } else { return sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } }