本文整理匯總了PHP中MYPDF::writeHTML方法的典型用法代碼示例。如果您正苦於以下問題:PHP MYPDF::writeHTML方法的具體用法?PHP MYPDF::writeHTML怎麽用?PHP MYPDF::writeHTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MYPDF
的用法示例。
在下文中一共展示了MYPDF::writeHTML方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadPage
function loadPage()
{
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->titulo = $this->getPlan();
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Red de Universidades Anahuac');
$pdf->SetTitle('Plan Estrategico');
$pdf->SetSubject($this->getPlan());
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
//$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'N', 11);
// add a page
$pdf->AddPage();
$pdf->SetY(5);
$html = "\n<!-- EXAMPLE OF CSS STYLE -->\n<style> \n\ttd{\n\tborder:1px solid #666;\n\t}\n\t\n\ttd.title{\n\tbackground:#E5E5E5;\n\tpadding:10px;\n\t}\n \n</style> <br />";
$html .= $this->Model->getLineas();
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
//Close and output PDF document
$pdf->Output('plan_operativo.pdf', 'I');
}
示例2: Footer
<tr><td></td></tr>
<tr><td></td></tr>
</table>
<table style="font-size: 9px; bottom:0">
<tr><td></td><td></td></tr>
<tr><td width="40px">C.C.P.</td><td width="500px">' . nl2br(trim(trim($dataOfi['CcpOfi'], 'C.C.P.'))) . '</td></tr>
</table>';
include "../../libs/tcpdf/tcpdf.php";
class MYPDF extends TCPDF
{
public function Footer()
{
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 8);
}
public function Header()
{
}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetMargins(20, 30, 20, true);
$pdf->SetFont('helvetica', '', 10);
$pdf->AddPage();
$pdf->writeHTML($contenido1, true, false, false, false, '');
ob_end_clean();
$pdf->Output('Oficio.pdf', 'I');
?>
示例3: date
<tr>
<td width="30%">
</td>
<td width="60%">
<table align="center">
<tr>
<td style="font-size:30px; border-top-width:1px;" width="30%"><strong>Firma Cajero Recaudación </strong></td>
<td> </td>
<td style="font-size:30px; border-top-width:1px;" width="30%"><strong>Firma Cajero Contabilidad</strong></td>
</tr>
</table>
</td>
</tr>
</table>
';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->Output($nombreUser . '_' . 'arqueoEspontaneo_' . $arq_id . '.pdf', $tipoDoc);
DEFINE('FTP_USER', 'recaudacion');
DEFINE('FTP_PASS', 'recaudacion');
$path = date('Y') . "/boleta/";
$path = explode("/", $path);
$conn_id = @ftp_connect("10.2.21.108", 21, 1);
if (!$conn_id) {
return false;
}
if (@ftp_login($conn_id, FTP_USER, FTP_PASS)) {
foreach ($path as $dir) {
if (!$dir) {
continue;
}
$currPath .= "/" . trim($dir);
示例4: MAX
<div id="wb_Text20" style="position:absolute;left:380px;top:72px;width:150px;height:16px;text-align:center;z-index:2;">
<span style="color:#00008B;font-family:'Bookman Old Style';font-size:10px;"><strong><em>CENTRO DE MECANIZADO, TORNO, FRESADORA, RECTIFICADORA DE SUPERFICIES PLANAS, RECTIFICADORA DE EJES, CEPILLO, PRENSA HIDRÁULICA,
SOLDADURAS: ELÉCTRICA Y AUTÓGENA; REPARACIÓN Y FABRICACIÓN DE PIEZAS <br> AGRO-INDRUSTRIALES
</em></strong></span></div>
<hr id="Line1" style="margin:0;padding:0;position:absolute;left:0px;top:44px;width:625px;height:2px;z-index:1;">
<div id="wb_Text5" style="position:absolute;left:334px;top:127px;width:335px;height:18px;z-index:7;text-align:left;">
<span style="color:#000000;font-family:'Bookman Old Style';font-size:13px;">Liquidacion de Horas Extras {$fecha}</span></div>
<hr id="Line3" style="margin:0;padding:0;position:absolute;left:0px;top:219px;width:625px;height:2px;z-index:9;">
</div>
EOD;
$pdf->writeHTML($tbl, false, false, false, false, '');
////////////////////////////////////////////////////////
//////////////////imprime los datos de los empleados y calcula el valor de las extras
///////////////////////////////////////////////////////
$NumMayor = mysql_query("SELECT MAX(idColaboradores) as maxnp FROM colaboradoresact") or die("Error al consultar la tabla de colaboradores activos 1");
$linea = mysql_fetch_array($NumMayor);
$maxID = $linea["maxnp"];
for ($i = 1; $i <= $maxID; $i++) {
$Datos = mysql_query("SELECT * FROM colaboradoresact WHERE idColaboradores={$i}") or die("Error al consultar la tabla de colaboradores activos 2");
$registros2 = mysql_fetch_array($Datos);
$idCol = $registros2["Identificacion"];
$Salario = $registros2["Salario"];
list($ExtraDiurna, $ExtraNoct, $ExtrasOrdFest, $ExtrasFestDiurna, $ExtrasFestNoct, $TotalED, $TotalEN, $TotalEDF, $TotalENF, $TotalOF, $GranTotal) = calculevalorextras($idCol, $Salario);
$tbl = <<<EOD
<br><br><br><br>
<hr id="Line3" style="margin:0;padding:0;position:absolute;left:0px;top:219px;width:625px;height:2px;z-index:9;">
示例5:
////////////////////////////////////////////////////////
$tbl = <<<EOD
<hr id="Line1" style="margin:0;padding:0;position:absolute;left:0px;top:44px;width:625px;height:2px;z-index:1;">
<div id="wb_Text5" style="position:absolute;left:334px;top:127px;width:335px;height:18px;z-index:7;text-align:left;">
<span style="color:#000000;font-family:'Bookman Old Style';font-size:13px;">Fecha: {$fecha}</span></div>
<div id="wb_Text1" style="position:absolute;left:380px;top:72px;width:150px;height:10px;text-align:center;z-index:2;">
<span style="color:#00008B;font-family:'Bookman Old Style';font-size:10px;"><strong><em>COMPROBANTE DE INFORME DE VENTAS
</em></strong></span><BR>
<span style="color:#00008B;font-family:'Bookman Old Style';font-size:10px;"><strong><em>RESULTADOS ENTRE EL {$FechaIni} Y EL {$FechaFinal}
</em></strong></span><BR><BR>
EOD;
$pdf->writeHTML($tbl, false, false, false, false, '');
///////////////////////////////////////////////////////
//////////////tabla con los datos//////////////////
////////////////////////////////////////////////////////
$tbl = <<<EOD
<span style="color:RED;font-family:'Bookman Old Style';font-size:12px;"><strong><em>Ventas por departamentos:
</em></strong></span><BR><BR>
<table border="1" cellpadding="3" cellspacing="4" align="center" >
<tr style= "background-color:#FE642E; color: white;" >
<th><h3>Departamento</h3></th>
<th><h3>Nombre</h3></th>\t\t
示例6:
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// remove default footer
$pdf->setPrintFooter(false);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 48);
// add a page
$pdf->AddPage();
// Pritn a text
$pdf->writeHTML('<span style="background-color:yellow;color:blue">PAGE 1</span>', $ln = true, $fill = false, $reseth = false, $cell = false, $align = '');
// add a page
$pdf->AddPage();
// Pritn a text
$pdf->writeHTML('<span style="background-color:yellow;color:blue">PAGE 2</span>', $ln = true, $fill = false, $reseth = false, $cell = false, $align = '');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_051.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
示例7: Log
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
////////////////////////////////////////////////////////////////////////////////
$datos = filter_input_array(INPUT_POST);
global $db, $smarty;
$log = new Log($db);
$registros = $log->ver_log($datos["hidden_usr"], $datos["hidden_desde"], $datos["hidden_hasta"], $datos["hidden_accion"], $datos["hidden_clase"]);
$smarty->assign("log", $registros);
////////////////////////////////////////////////////////////////////////////////
$html = $smarty->fetch("templates/admin/print_log.html");
$pdf->AddPage('L');
$pdf->SetFont('helvetica', '', 8);
$pdf->writeHTML($html, true, 0, 0, 0);
$pdf->Output('print_log_'.date("d/m/Y g:i a").'.pdf', 'D');
?>
示例8:
$pdf->SetTextColor(190);
$pdf->SetY(5);
$pdf->Write(10, 'Facture ' . $id_ventes . ' ', '', 0, 'R', true);
/*écriture "ACQUITTEE"
if ($donnees['paiement']==1){
$pdf->SetFont('times', '', 49);
$pdf->SetY(10);
$pdf->SetTextColor(250,0,0);
$pdf->Write(10, 'ACQUITTE','',0, 'R',true);
}
*/
$pdf->SetFont('times', '', 9);
$pdf->SetY(30);
$pdf->SetTextColor(0);
// set columns width
$first_column_width = 100;
$second_column_width = 60;
// get current vertical position
$current_y_position = $pdf->getY();
//trois colonnes
$pdf->writeHTMLCell($first_column_width, '', '', $current_y_position, $txt_nous, 1, 0, 0, true);
$pdf->writeHTMLCell($second_column_width, '', 133, '', $txt_eux, 1, 0, 0, true);
$pdf->writeHTMLCell($second_column_width, '', 133, 60, $txt_divers, 1, 1, 0, 'C', true);
$pdf->writeHTML($txt1);
// ---------------------------------------------------------
//Close and output PDF document
//$pdf->Output('C:\wamp\www\valocal\valocal\admin-sec\pdf\factures\facture_'.$id_ventes.'.pdf', 'F'); //F for saving output to file
$pdf->Output('/home/clients/fdd1a6019f1e8376cbae15369dc54de1/web/applis/admin-sec/pdf/recus/recu_' . $id_ventes . '.pdf', 'F');
//F for saving output to file
$pdf->Output('Facture-VALOCAL-' . $id_ventes . '.pdf', 'I');
}
示例9: getModel
function dispNstore_digitalCertificate()
{
$oNstore_digitalModel = getModel('nstore_digital');
$logged_info = Context::get('logged_info');
$cart_srl = Context::get('cart_srl');
if (!Context::get('is_logged')) {
return new Object(-1, 'msg_login_required');
}
$config = $oNstore_digitalModel->getModuleConfig();
$item_info = $oNstore_digitalModel->getPurchasedItem($logged_info->member_srl, $cart_srl);
Context::set('item_info', $item_info);
if (!in_array($item_info->order_status, array('3'))) {
return new Object(-1, '구매완료된 상품이 아닙니다.');
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 006');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
/*
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
*/
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
//$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// remove default header/footer
//$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
//$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
//$pdf->SetFont('dejavusans', '', 10);
$pdf->SetFont('cid0kr', '', 16);
// table line height
//$pdf->setCellHeightRatio(1.9);
$pdf->setCellHeightRatio(1.7);
// add a page
$pdf->AddPage();
// output the HTML content
$this->setTemplatePath($this->module_path . "tpl");
$oTemplate =& TemplateHandler::getInstance();
$output = $oTemplate->compile($this->module_path . 'tpl', 'certificate');
$pdf->writeHTML($output, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();
//Close and output PDF document
$pdf->Output('certificate.pdf', 'I');
exit;
}
示例10: boookattach
function boookattach($results, $type = '')
{
// Include the main TCPDF library (search for installation path).
//require_once('tcpdf/examples/tcpdf_include.php');
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'utf-8', false);
//$pdf->Footer('hello');
// create new PDF document
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
//$pdf->SetAuthor('Nicola Asuni');
//$pdf->SetTitle('TCPDF Example 001');
//$pdf->SetSubject('<h1>TCPDF Tutorial</h1>');
//$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, '<div style="float:right">haoooooooo</div>', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(20);
//echo PDF_MARGIN_FOOTER;exit;
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
//$pdf->SetFont('dejavusans', '', 10, '', true);
$pdf->SetFont('Helvetica', '', 10, '', 'false');
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 1, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 0, 'blend_mode' => 'Normal'));
// Set some content to print
$tbl = '<br /><br/><br/><br/>
<table border="0" cellpadding="2" cellspacing="2" nobr="true">
<tr>
<td style="width:60%"><b>Your Personal Travel Advisor:</b>' . @$results['pdfdata']['adviser_info']['name'] . '</td>
<td style="width:40%"><b>Quote Reference:</b>' . @$results['pdfdata']['adviser_info']['reference'] . '</td>
</tr>
<tr>
<td style="width:60%"><b>Phone Number:</b>' . @$results['pdfdata']['adviser_info']['phone'] . '</td>
<td style="width:40%"><b>Date:</b> ' . @$results['pdfdata']['adviser_info']['date'] . '</td>
</tr>
<tr>
<td style="width:60%"><b>Email Address:</b>' . @$results['pdfdata']['adviser_info']['email'] . '</td>
<td style="width:40%"><b>Adults:</b> ' . @$results['seg'][0]['num_adults'] . ' <b>Children:</b> ' . @$results['seg'][0]['num_children'] . '</td>
</tr>
</table>';
$pdf->writeHTML($tbl, true, false, false, false, '');
//$ci = $results['controller'];
$t = json_decode($results['row'][0]['adults_info'], true);
$tbl = '
<div>
<span>Dear ' . $t['fname'][0] . '</span>
</br>
<p>
I have pleasure in enclosing a quote in respect of your recent enquiry with Super Escapes. Please feel free to contact us, should you need any more information or advice.
</p>
</div>';
$pdf->writeHTML($tbl, true, false, false, false, '');
if (isset($results['fobj'])) {
$depts = fetch_departures();
$arrivs = fetch_arrivals();
$dep_arr = explode('-', $depts[$results['fobj']['@attributes']['depapt']]);
$arr_arr = explode('-', $arrivs[$results['fobj']['@attributes']['arrapt']]);
$ret_arr = explode('-', $depts[$results['fobj']['@attributes']['retapt']]);
$dept_start_time = substr(explode(' ', $results['fobj']['@attributes']['outdep'])[1], 0, -3);
$dept_arr_time = substr(explode(' ', $results['fobj']['@attributes']['outarr'])[1], 0, -3);
$return_start_time = substr(explode(' ', $results['fobj']['@attributes']['indep'])[1], 0, -3);
$return_arr_time = substr(explode(' ', $results['fobj']['@attributes']['inarr'])[1], 0, -3);
$tbl = '
<b><u>Flight Details : </u></b><br><br>
<table border="0" cellpadding="2" cellspacing="2" nobr="true">
<tr>
<th style="width:35%;text-align:center;font-weight:bold;">Route</th>
<td style="width:13%;text-align:center;font-weight:bold;">Dep Date</td>
<td style="width:13%;text-align:center;font-weight:bold;">Dep Time</td>
<td style="width:13%;text-align:center;font-weight:bold;">Arr Date</td>
<td style="width:13%;text-align:center;font-weight:bold;">Arr Time</td>
<td style="width:13%;text-align:center;font-weight:bold;">Flight No</td>
//.........這裏部分代碼省略.........
示例11: download_consolidated_pdf_report
public function download_consolidated_pdf_report()
{
$user = JFactory::getUser();
$app = JFactory::getApplication();
$model = $this->getModel('survey');
$params = JComponentHelper::getParams(S_APP_NAME);
$id = $app->input->getInt('id', 0);
if (!$id || !$model->authorize_survey($id)) {
CJFunctions::throw_error(JText::_('MSG_UNAUTHORIZED'), 401);
} else {
$wysiwyg = $user->authorise('core.wysiwyg', S_APP_NAME) ? true : false;
$bbcode = $wysiwyg && $params->get('default_editor', 'bbcode') == 'bbcode';
$content = $params->get('process_content_plugins', 0) == 1;
require_once JPATH_COMPONENT . '/helpers/reports.php';
$generator = new SurveyReports($wysiwyg, $bbcode, $content);
$survey = $model->get_consolidated_report($id);
$headStyles = array();
$headStyles[] = CJLIB_URI . '/bootstrap/css/bootstrap.min.css';
$headStyles[] = JURI::root(true) . '/media/' . S_APP_NAME . '/css/cj.surveys.min.css';
$headScripts = array();
$headScripts[] = CJLIB_URI . '/jquery/jquery.min.js';
$headScripts[] = CJLIB_URI . '/jquery/jquery.noconflict.js';
$headScripts[] = CJLIB_URI . '/bootstrap/js/bootstrap.min.js';
$headScripts[] = 'https://www.google.com/jsapi';
$headScripts[] = JURI::root(true) . '/media/' . S_APP_NAME . '/js/cj.surveys.min.js';
$html = '<html xmlns="http://www.w3.org/1999/xhtml" dir="' . JFactory::getDocument()->direction . '"><head>';
$html = $html . '<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="content-type" content="text/html; charset=utf-8" />';
// foreach ($headStyles as $style)
// {
// $html = $html . '<link rel="stylesheet" href="'.$style.'" type="text/css" />';
// }
// foreach ($headScripts as $script)
// {
// $html = $html . '<script src="'.$script.'" type="text/javascript"></script>';
// }
// $html .= '<script type="text/javascript">google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(SurveyFactory.draw_consolidated_charts);</script>';
$html .= '</head><body><div id="cj-wrapper" class="container-fuild"><div class="reports-wrapper margin-top-20">';
$html .= '<h2 class="page-header margin-bottom-10">' . CJFunctions::escape($survey->title) . '</h2>';
foreach ($survey->questions as $item) {
switch ($item->question_type) {
case 1:
$html .= $generator->get_page_header_question($item, '');
break;
case 2:
case 3:
case 4:
case 11:
case 12:
$html .= $generator->get_choice_question($item, '');
break;
case 5:
case 6:
$html .= $generator->get_grid_question($item, '');
break;
}
}
$html .= '</div></div></body></html>';
// All validations done, write data now
$fileName = 'survey_' . $id . '_' . date('dmYHis') . '.pdf';
// create new PDF document
require_once JPATH_COMPONENT_SITE . '/helpers/tcpdf.php';
$pdf = new MYPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set default header data
$pdf->SetHeaderData('logo.png', PDF_HEADER_LOGO_WIDTH, $survey->title, '');
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('corejoomla.com');
$pdf->SetTitle('Survey Report');
$pdf->SetSubject('Consolidated Report');
$pdf->SetKeywords('survey, report');
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// ---------------------------------------------------------
// set font
$pdf->SetFont('freesans');
$pdf->AddPage();
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->lastPage();
$pdf->Output($fileName, $mode);
jexit();
}
}
示例12: setup_pdf
public function setup_pdf()
{
//echo "setup_pdf";
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Havering Carepoint');
$pdf->SetTitle($this->post_title);
$pdf->SetSubject($this->post_title);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, '', '');
// // set header and footer fonts
// $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
// $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// // set default monospaced font
// $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// // set image scale factor
// $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// // set font
// $pdf->SetFont('dejavusans', '', 10);
// add a page
$pdf->AddPage();
// output the HTML content
$html = '<h1>'.$this->post_title.'</h1>'.apply_filters('the_content', $this->post_content);
$html .= '<br/><small>This PDF was downloaded from: <a href="'.get_permalink($this->post_id).'">'.get_permalink($this->post_id).'</a></small>';
if(get_field('nhs_choices', $this->post_id) != ""):
$html .= '<style>
.nhs-choices-label{
float: left;
display: block;
padding: 5px;
margin-bottom: 20px;
border: 3px solid #DFDFDF;}
</style>
<table class="nhs-choices-label">
<tr>
<td>
<small>This article is sourced from:</small>
<img src="'.get_bloginfo("template_url").'/library/images/nhs-choices-logo.jpg" alt="NHS Choices">
</td>
</tr>
</table>';
endif;
$pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();
//Close and output PDF document
$pdf->Output($this->post_title.'.pdf', 'I');
}
示例13: printToServer
function printToServer($content, $name, $client, $folder_name, $version)
{
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setVersion($version);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Ignitor Labs');
$pdf->setHeaderFont(false);
$pdf->setPrintHeader(false);
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// add a page
$pdf->AddPage();
// set font
$pdf->SetFont('times', 'BI', 20, '', 'false');
//$pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0);
// create some HTML content
$html = $content;
// set core font
$pdf->SetFont('helvetica', '', 10);
// output the HTML content
$pdf->writeHTML($html, true, 0, true, true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('assets/contracts/' . $folder_name . '/' . $client . '_' . $name . '.pdf', 'F');
}
示例14: dirname
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// add a page
$pdf->AddPage();
// set font
$pdf->SetFont('times', 'BI', 20, '', 'false');
//$pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0);
// create some HTML content
$html = $history['content'];
// set core font
$pdf->SetFont('helvetica', '', 10);
// output the HTML content
$pdf->writeHTML($html, true, 0, true, true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output($_GET['name'] . "v" . $_GET['version'] . '.pdf', 'I');
示例15: foreach
$pdf->Ln(1);
$inicio_tabla_nomProyecto = "";
$inicio_tabla_nomProyecto .= "<tr>\r\n <th width=\"155\">Nombre de la obra:</th>\r\n <td width=\"485\" class=\"contenido\">" . utf8_encode($avData['NomObr']) . "</td>\r\n </tr> \r\n\t\t\t<tr> \r\n <th width=\"155\">Descripción del proyecto:</th>\r\n <td width=\"485\" class=\"contenido\">" . utf8_encode($avData['PriCar']) . "</td>\r\n\t\t\t</tr>\r\n <tr> \r\n <th width=\"155\">Monto total de inversión:</th>\r\n <td width=\"485\" class=\"contenido\">\$" . number_format($avData['Monto'], 2) . "</td>\r\n\t\t\t</tr>\r\n <tr> \r\n <th width=\"155\">Sector:</th>\r\n <td width=\"485\" class=\"contenido\">" . utf8_encode($avData['NomSec']) . "</td>\r\n\t\t\t</tr>\r\n <tr> \r\n <th width=\"155\">Tipo de PPI:</th>\r\n <td width=\"485\" class=\"contenido\">" . utf8_encode($rPPI['NomPPI']) . "</td>\r\n\t\t\t</tr>";
foreach ($rFtes as $key => $valoresFtes) {
$inicio_tabla_nomProyecto .= "\r\n <tr nobr=\"true\">\r\n <th width=\"155\">Fuente de financiamiento " . $valoresFtes['tipoFte'] . ":</th>\r\n <td width=\"485\" class=\"contenido\">\$" . number_format($valoresFtes['monto'], 2) . " " . utf8_encode($valoresFtes['DscFte']) . "</td>\r\n </tr>";
}
if ($avData['MonMun'] !== "" && $avData['MonMun'] !== "0.00") {
$inicio_tabla_nomProyecto .= "\r\n <tr nobr=\"true\">\r\n <th width=\"155\">Fuente de financiamiento Municipal:</th>\r\n <td width=\"485\" class=\"contenido\">\$" . number_format($avData['MonMun'], 2) . " " . utf8_encode($avData['FteMun']) . "</td>\r\n </tr>";
}
$inicio_tabla_nomProyecto .= "<tr> \r\n <th width=\"155\">Unidad Responsable:</th>\r\n <td width=\"485\" class=\"contenido\">" . utf8_encode($avData['NomUE']) . "</td>\r\n\t\t\t</tr>\r\n <tr> \r\n <th width=\"155\">Observaciones generales:</th>\r\n <td width=\"485\" class=\"contenido\">" . utf8_encode($infoInd['obs']) . "</td>\r\n\t\t\t</tr>";
$tabla_nomProyecto = "\r\n\t\t<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" class=\"general\" >\r\n {$inicio_tabla_nomProyecto}\r\n\t\t</table>\r\n\t\t";
$html = <<<EOD
{$estilo_tabla}
{$tabla_nomProyecto}
EOD;
$pdf->writeHTML($html, true, false, false, false, '');
$pdf->SetFont('times', '', 9);
$pdf->Cell(0, 0, strtoupper('Resultado del dictamen'), 0, 1, 'C', 0, 1);
$pdf->Ln(2);
//----tabla detalle
$row_Conceptos = "";
$i = 0;
$punto = "";
$inciso = "";
foreach ($avData2 as $key => $value) {
$auxpto = utf8_encode($value['nompto']);
$auxinc = utf8_encode($value['etinc']);
if ($punto == "" || $punto != $auxpto) {
$row_Conceptos .= "\r\n <tr nobr=\"true\">\r\n <th colspan=\"3\" align=\"center\" class=\"verde\"><FONT SIZE=\"8\">" . utf8_encode($value['nompto']) . "</font></th>\r\n </tr>";
}
if (($inciso == "" || $inciso != $auxinc) && $value['imprime'] == 1) {