Example #1
0
 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');
 }
Example #2
0
                    <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');
?>

Example #3
0
					<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>&nbsp;</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);
Example #4
0
<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;">
////////////////////////////////////////////////////////
$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
    
// 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
//============================================================+
Example #7
0
$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');


?>
Example #8
0
    $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');
}
Example #9
0
 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;
 }
Example #10
0
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>
	</tr>
    <tr>
        <td >' . current($dep_arr) . ' Airport ' . array_pop($arr_arr) . ' Airport</td>
        <td>' . explode(' ', $results['fobj']['@attributes']['outdep'])[0] . '</td>
		<td>' . $dept_start_time . '</td>
		<td>' . explode(' ', $results['fobj']['@attributes']['outarr'])[0] . '</td>
		<td>' . $dept_arr_time . '</td>
		<td>' . $results['fobj']['@attributes']['outfltnum'] . '</td>
    </tr>
    <tr>
         <td >' . array_pop($arr_arr) . ' Airport ' . current($ret_arr) . ' Airport</td>
		<td>' . explode(' ', $results['fobj']['@attributes']['indep'])[0] . '</td>    	
		<td>' . $return_start_time . '</td>
		<td>' . explode(' ', $results['fobj']['@attributes']['inarr'])[0] . '</td>
		<td>' . $return_arr_time . '</td>
		<td>' . $results['fobj']['@attributes']['infltnum'] . '</td>
    </tr>  
</table>';
        $pdf->writeHTML($tbl, true, false, false, false, '');
    }
    $ci = $results['controller'];
    if (!empty($results['hobjs'])) {
        $tbl = '
<b><u>Accommodation Details: </u></b><br><br>  
<table border="0" cellpadding="2" cellspacing="2" nobr="true">
	<tr>
		<th style="text-align:center;font-weight:bold;">Hotel</th>
		<td style="text-align:center;font-weight:bold;">Resort</td>
		<td style="text-align:center;font-weight:bold;">Board</td>
		<td style="text-align:center;font-weight:bold;">Room</td>
		<td style="text-align:center;font-weight:bold;">Rating</td>		
	</tr>
    <tr>
        <td style="text-align:center;">' . urldecode($results['hobjs'][0]['@attributes']['hotelname']) . '</td>
        <td style="text-align:center;">' . urldecode($results['hobjs'][0]['@attributes']['resort']) . '</td>
		<td style="text-align:center;">' . boardbasis($results['hobjs'][0]['@attributes']['boardbasis']) . '</td>
		<td style="text-align:center;">' . $results['seg'][0]['num_rooms'] . ' ' . $results['hobjs'][0]['@attributes']['suppname'] . '</td>
		<td style="text-align:center;">' . (int) $results['hobjs'][0]['@attributes']['starrating'] . ' KEY</td>		
    </tr>
    <tr>
		<td style="text-align:center;font-weight:bold;">Check In</td>
    	<td style="text-align:center;font-weight:bold;">Check Out</td>
		<td style="text-align:center;font-weight:bold;">Adults</td>
		<td style="text-align:center;font-weight:bold;">Children</td>
		<td style="text-align:center;font-weight:bold;">Infants</td>
    </tr>
	<tr>
		<td style="text-align:center;">' . $results['hobjs'][0]['@attributes']['checkindate'] . '</td>
    	<td style="text-align:center;">' . date('d/m/Y', strtotime('+' . $results['hobjs'][0]['@attributes']['nights'] . " day", $ci->cvtDt(str_date($results['hobjs'][0]['@attributes']['checkindate'])))) . '</td>
		<td style="text-align:center;">' . @$results['seg'][0]['num_adults'] . '</td>
		<td style="text-align:center;">' . @$results['seg'][0]['num_children'] . '</td>
		<td style="text-align:center;"></td>
    </tr>	
</table>';
        $pdf->writeHTML($tbl, true, false, false, false, '');
    }
    $tbl = <<<EOD
<div style="margin-top:20px;">
\t<b><u>Price Summary:</u></p>\t
\t<p>
\t\tThe total price inclusive of any discounts for the holiday described above is: £653.92 To make a firm reservation please call us on 01386298033 and quote the reference number at the top of this quote. Our friendly and experienced travel consultants will be happy to book the above holiday or look for any alternatives that may suit your needs. 
\t</p>
\t<p>\t\t
\t\tMay we take this opportunity of thanking you for your enquiry, and we do hope that we are able to assist you in fulfilling your requirements.
\t</p>
</div>
EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    $tbl = <<<EOD
<div style="margin-top:20px;text-align:center;">\t
\t<small>
\t\t* All costings are subject to a final confirmation which will be given upon making a firm reservation *
\t</small>
</div><br/><br/>
EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    /*$tbl = '
    <div style="margin-top:20px;width:100%;display:inline-flex;">	
    	<div style="color:blue;text-align:center;width:60%">BookItNow Travel is a trading name of broadway Travel Services (Wimbledon) Ltd. Whose registered office is at Unit 1,Finway,Dallow Road,Luton,Beds LUI 1WE</div>
    	<div> <img src="'.base_url().'/images/abta.png"/></div>
    </div>';
    $pdf->writeHTML($tbl, true, false, false, false, '');*/
    //echo $tbl;exit;
    $tbl = '
<div style="margin-top:20px;">
	<span>Yours sincerely</span>
	<p>' . @$results['pdfdata']['adviser_info']['name'] . '</p>
</div>';
    $pdf->writeHTML($tbl, true, false, false, false, '');
    if (!empty($results['hobjs'])) {
        // $hotel_meta = new SimpleXMLElement(download_page('http://87.102.127.86:8005/search/websearch.exe?pageid=7&compid=1&brochurecode=BEWE-AMTSES1CO0'));
        $hotel_meta = new SimpleXMLElement(download_page('http://87.102.127.86:8005/search/websearch.exe?pageid=7&compid=1&brochurecode=' . $results['hobjs'][0]['@attributes']['brocode']));
        $i = 1;
        $desc = urldecode($hotel_meta->HotelDescription);
        $ty = new tidy();
        $desc = $ty->repairString($desc);
        $tbl = '<br /><br/><br/><br/><h2 style="text-align:center; "pagebreak="true">Accommodation Info</h2><table>';
        foreach ($hotel_meta->Images->Url as $img) {
            $tbl .= '<tr>';
            //Allow_url_fopen must be On
            if (is_array(@getimagesize(urldecode($img)))) {
                $tbl .= '<td colspan="1"  style="margin-right: 30px !important;"><img src="' . urldecode($img) . '" /></td>';
            } else {
                $tbl .= '<td colspan="3"><img src="' . base_url() . '/images/destination_placeholder.jpg"/></td>';
            }
            $tbl .= '<td colspan="1"></td>';
            if ($i == 1) {
                $tbl .= '<td rowspan="' . count($hotel_meta->Images->Url) . '" colspan="8">' . $desc . '</td>';
            }
            $tbl .= '</tr>';
            //$tbl .= '<style>.desc{background:red;}</style>';
            $i++;
        }
        $tbl .= '</table>';
        //echo $tbl;exit;
        $pdf->writeHTML($tbl, true, false, false, false, '');
    }
    // ---------------------------------------------------------
    // Close and output PDF document
    // This method has several options, check the source code documentation for more information.
    //$pdf->Output('D:\xampp\htdocs\test_plugins\tcpdf\examples\example_001.pdf', 'F');
    if ($type == 'email') {
        $pdf->Output(getcwd() . '/booking_files/' . $results['pdfdata']['adviser_info']['reference'] . '.pdf', 'F');
        if (file_exists(getcwd() . '/booking_files/' . $results['pdfdata']['adviser_info']['reference'] . '.pdf')) {
            $subject = 'Quick Quote Ref: ' . $results['pdfdata']['adviser_info']['reference'] . ' - Book it now';
            $body = 'Dear ' . $t['fname'][0];
            $body .= '<p></p>';
            $body .= '<p>Please find the attached document</p>';
            $body .= '<p></p>';
            $body .= '<p>Cheers</p>';
            $body .= '<p>BootItNow</p>';
            $from = '*****@*****.**';
            $sendername = "BookItNow Admin";
            $list = array($results['row'][0]['email']);
            $config['protocol'] = "smtp";
            $config['smtp_host'] = 'mail.expertwebworx.in';
            $config['smtp_port'] = '25';
            $config['smtp_user'] = '******';
            $config['smtp_pass'] = '******';
            $config['smtp_crypto'] = 'tls';
            $config['charset'] = "iso-8859-1";
            $config['mailtype'] = "html";
            $ci->load->library('email', $config);
            $ci->email->set_newline("\r\n");
            $ci->email->from($from, $sendername);
            $ci->email->to($list);
            $ci->email->reply_to($from, $sendername);
            $ci->email->subject($subject);
            $ci->email->attach(getcwd() . '/booking_files/' . $results['pdfdata']['adviser_info']['reference'] . '.pdf');
            $ci->email->message($body);
            if ($ci->email->send()) {
            }
        }
    } else {
        $pdf->Output($results['pdfdata']['adviser_info']['reference'] . '.pdf', 'D');
        exit;
    }
    //============================================================+
    // END OF FILE
    //============================================================+
}
Example #11
0
 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();
     }
 }
Example #12
0
 public function sendGiftCard($order_id)
 {
     $url = JURI::root();
     $giftcardmail_body = '';
     $giftcardmail = $this->_redshopMail->getMailtemplate(0, "giftcard_mail");
     if (count($giftcardmail) > 0) {
         $giftcardmail = $giftcardmail[0];
     }
     $query = 'SELECT * FROM ' . $this->_table_prefix . 'order_item ' . 'WHERE order_id = ' . (int) $order_id . ' AND is_giftcard=1';
     $this->_db->setQuery($query);
     $orders = $this->_db->loadObjectList();
     foreach ($orders as $eachorders) {
         $giftcardmailsub = $giftcardmail->mail_subject;
         $giftcardData = $this->_producthelper->getGiftcardData($eachorders->product_id);
         $thum_image = "<img src='" . REDSHOP_FRONT_IMAGES_ABSPATH . "giftcard/" . $giftcardData->giftcard_image . "'  title='" . $giftcardData->giftcard_name . "' alt='" . $giftcardData->giftcard_name . "'></a>";
         $giftcard_value = $this->_producthelper->getProductFormattedPrice($giftcardData->giftcard_value, true);
         $giftcard_price = $eachorders->product_final_price;
         $giftcardmail_body .= $giftcardmail->mail_body;
         $giftcard_name = $giftcardData->giftcard_name;
         $giftcardmail_body = str_replace('{giftcard_name}', $giftcardData->giftcard_name, $giftcardmail_body);
         $user_fields = $this->_producthelper->GetProdcutUserfield($eachorders->order_item_id, 13);
         $giftcardmail_body = str_replace("{product_userfields}", $user_fields, $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_price_lbl}", JText::_('COM_REDSHOP_GIFTCARD_PRICE_LBL'), $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_price}", $this->_producthelper->getProductFormattedPrice($giftcard_price), $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_reciver_name_lbl}", JText::_('COM_REDSHOP_GIFTCARD_RECIVER_NAME_LBL'), $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_reciver_email_lbl}", JText::_('COM_REDSHOP_GIFTCARD_RECIVER_EMAIL_LBL'), $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_reciver_email}", $eachorders->giftcard_user_email, $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_reciver_name}", $eachorders->giftcard_user_name, $giftcardmail_body);
         $giftcardmail_body = $this->_producthelper->getValidityDate($giftcardData->giftcard_validity, $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_value}", $giftcard_value, $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_value_lbl}", JText::_('COM_REDSHOP_GIFTCARD_VALUE_LBL'), $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_desc}", $giftcardData->giftcard_desc, $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_validity}", $giftcardData->giftcard_validity, $giftcardmail_body);
         $giftcardmailsub = str_replace('{giftcard_name}', $giftcardData->giftcard_name, $giftcardmailsub);
         $giftcardmailsub = str_replace('{giftcard_price}', $this->_producthelper->getProductFormattedPrice($giftcard_price), $giftcardmailsub);
         $giftcardmailsub = str_replace('{giftcard_value}', $giftcard_value, $giftcardmailsub);
         $giftcardmailsub = str_replace('{giftcard_validity}', $giftcardData->giftcard_validity, $giftcardmailsub);
         $gift_code = $this->_order_functions->random_gen_enc_key(12);
         $couponItems = $this->getTable('coupon_detail');
         if ($giftcardData->customer_amount) {
             $giftcardData->giftcard_value = $eachorders->product_final_price;
         }
         $couponItems->coupon_code = $gift_code;
         $couponItems->percent_or_total = 0;
         $couponItems->coupon_value = $giftcardData->giftcard_value;
         $couponItems->start_date = strtotime(date('d M Y'));
         $couponItems->end_date = mktime(0, 0, 0, date('m'), date('d') + $giftcardData->giftcard_validity, date('Y'));
         $couponItems->coupon_type = 0;
         $couponItems->userid = 0;
         $couponItems->coupon_left = 1;
         $couponItems->published = 1;
         if (!$couponItems->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $giftcardmail_body = str_replace("{giftcard_code_lbl}", JText::_('COM_REDSHOP_GIFTCARD_CODE_LBL'), $giftcardmail_body);
         $giftcardmail_body = str_replace("{giftcard_code}", $gift_code, $giftcardmail_body);
         ob_flush();
         ob_clean();
         echo "<div id='redshopcomponent' class='redshop'>";
         $is_giftcard = 1;
         $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
         if (file_exists(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $giftcardData->giftcard_bgimage) && $giftcardData->giftcard_bgimage) {
             $pdf->img_file = REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $giftcardData->giftcard_bgimage;
         }
         $pdf->SetCreator(PDF_CREATOR);
         $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
         $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         $pdf->SetHeaderMargin(0);
         $pdf->SetFooterMargin(0);
         $pdf->setPrintFooter(false);
         $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
         $pdf->SetFont('times', '', 18);
         $pdf->AddPage();
         $pdfImage = "";
         if (file_exists(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $giftcardData->giftcard_image) && $giftcardData->giftcard_image) {
             $pdfImage = '<img src="' . REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $giftcardData->giftcard_image . '" alt="test alt attribute" width="150px" height="150px" border="0" />';
         }
         $giftcardmail_body = str_replace("{giftcard_image}", $pdfImage, $giftcardmail_body);
         $pdf->writeHTML($giftcardmail_body, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '');
         $g_pdfName = time();
         $pdf->Output(JPATH_SITE . '/components/com_redshop/assets/orders/' . $g_pdfName . ".pdf", "F");
         $config = JFactory::getConfig();
         $from = $config->getValue('mailfrom');
         $fromname = $config->getValue('fromname');
         $giftcard_attachment = JPATH_SITE . '/components/com_redshop/assets/orders/' . $g_pdfName . ".pdf";
         JUtility::sendMail($from, $fromname, $eachorders->giftcard_user_email, $giftcardmailsub, $giftcardmail_body, 1, '', '', $giftcard_attachment);
     }
 }
	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');
	}
Example #14
0
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');
}
$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');
Example #16
0
    $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) {
Example #17
0
$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, 10, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(FALSE);
$pdf->SetPrintFooter(false);
//set image scale factor
//$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$count = 0;
// add a page
$hea = 'Header Information';
//$pdf->writeHTML($hea, true, 0, true, 0);
$pdf->AddPage();
$pkt11 = 'sagdfsadfashfdhasdhfhfghf';
$pdf->writeHTML($pkt11, true, 0, true, 0);
$pdf->SetFont('helvetica', '', 12);
$pdf->Ln(5);
$pdf->SetFont('times', '', 12);
$pdf->Output('bill.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
 function generate_pdf_file($id, $forceDownload = false)
 {
     $post = get_post();
     $content = $post->the_content;
     if (has_shortcode($content, 'wpptopdfenh')) {
         if (!$this->options[$post->post_type]) {
             return false;
         }
     }
     // require_once(WPPTOPDFENH_PATH . '/tcpdf/config/lang/eng.php');
     // to avoid duplicate function error
     if (!class_exists('TCPDF')) {
         require_once WPPTOPDFENH_PATH . '/tcpdf/tcpdf.php';
     }
     if (!class_exists('MYPDF')) {
         require_once WPPTOPDFENH_PATH . '/wpptopdfenh_header.php';
     }
     // to avoid duplicate function error ( conflict with Lightbox Plus v2.4.6 )
     if (!class_exists('simple_html_dom')) {
         require_once WPPTOPDFENH_PATH . '/simplehtmldom/simple-html-dom.php';
     }
     $filePath = WPPTOPDFENH_CACHE_DIR . '/' . $post->post_name . '.pdf';
     // create new PDF document
     if (isset($this->options['pageSize'])) {
         $pagesize = $this->options['pageSize'];
     } else {
         $pagesize = PDF_PAGE_FORMAT;
     }
     if (isset($this->options['unitMeasure'])) {
         $unit = $this->options['unitMeasure'];
     } else {
         $unit = PDF_UNIT;
     }
     if (isset($this->options['orientation'])) {
         $orientation = $this->options['orientation'];
     } else {
         $unit = PDF_PAGE_ORIENTATION;
     }
     $pdf = new MYPDF($orientation, $unit, $pagesize, true, 'UTF-8', false);
     // Let other filter modify content if selected
     if (isset($this->options['otherPlugin'])) {
         $post->post_content = apply_filters('the_content', $post->post_content);
     } else {
         $post->post_content = wpautop($post->post_content);
     }
     // Process shortcodes if selected
     if (isset($this->options['processShortcodes'])) {
         $post->post_content = do_shortcode($post->post_content);
     } else {
         $post->post_content = strip_shortcodes($post->post_content);
     }
     // set document information
     $pdf->SetCreator('WP Post to PDF Enhanced plugin by Lewis Rosenthal (http://www.2rosenthals.net/wordpress/help/general-help/wp-post-to-pdf-enhanced/) with ' . PDF_CREATOR);
     $pdf->SetAuthor(get_bloginfo('name'));
     $pdf->SetTitle(apply_filters('the_title', $post->post_title));
     // Count width of logo for better presentation
     if (isset($this->options['headerlogoImage'])) {
         $logo = PDF_HEADER_LOGO;
         $logodata = getimagesize(PDF_HEADER_LOGO);
         if (isset($this->options['headerlogoImageFactor'])) {
             $logowidth = (int) ($this->options['headerlogoImageFactor'] * $logodata[0] / $logodata[1]);
         } else {
             $logowidth = (int) (14 * $logodata[0] / $logodata[1]);
         }
     }
     // new feature under development: specify header/footer text/separator color
     // some addtional header data which should be set in the admin UI; for testing, we're hiding the separator line (note the RGB array)
     //$header_text_color = array( 0,0,0 );
     //$header_line_color = array( 255,255,255 );
     // some addtional footer data which should be set in the admin UI; for testing, we're hiding the separator line (note the RGB array)
     //$footer_text_color = array( 0,0,0 );
     //$footer_line_color = array( 255,255,255 );
     //$pdf->SetSubject('TCPDF Tutorial');
     //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data, as appropriate for PHP 5.4 or below
     if (version_compare(phpversion(), '5.4.0', '<')) {
         $pdf->SetHeaderData($logo, $logowidth, html_entity_decode(get_bloginfo('name'), ENT_COMPAT | ENT_QUOTES), html_entity_decode(get_bloginfo('description') . "\n" . home_url(), ENT_COMPAT | ENT_QUOTES), $header_text_color, $header_line_color);
     } else {
         $pdf->SetHeaderData($logo, $logowidth, html_entity_decode(get_bloginfo('name'), ENT_COMPAT | ENT_HTML401 | ENT_QUOTES), html_entity_decode(get_bloginfo('description') . "\n" . home_url(), ENT_COMPAT | ENT_HTML401 | ENT_QUOTES), $header_text_color, $header_line_color);
     }
     // set header and footer fonts
     $pdf->setHeaderFont(array($this->options['headerFont'], '', $this->options['headerFontSize']));
     $pdf->setFooterFont(array($this->options['footerFont'], '', $this->options['footerFontSize']));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     if ($this->options['marginLeft'] > 0) {
         $pdf->SetLeftMargin($this->options['marginLeft']);
     } else {
         $pdf->SetLeftMargin(PDF_MARGIN_LEFT);
     }
     if ($this->options['marginRight'] > 0) {
         $pdf->SetRightMargin($this->options['marginRight']);
     } else {
         $pdf->SetRightMargin(PDF_MARGIN_RIGHT);
     }
     if ($this->options['marginTop'] > 0) {
         $pdf->SetTopMargin($this->options['marginTop']);
     } else {
         $pdf->SetTopMargin(PDF_MARGIN_TOP);
     }
     if ($this->options['marginHeader'] > 0) {
         $pdf->SetHeaderMargin($this->options['marginHeader']);
     } else {
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     }
     if ($this->options['marginFooter'] > 0) {
         $pdf->SetFooterMargin($this->options['marginFooter']);
     } else {
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     }
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     if ($this->options['imageScale'] > 0) {
         $pdf->setImageScale($this->options['imageScale']);
     } else {
         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     }
     // ---------------------------------------------------------
     // Set the default LI image, if specified
     if (isset($this->options['liSymbol'])) {
         $lisymbol = 'img|' . $this->options['liSymbolType'] . '|' . $this->options['liSymbolWidth'] . '|' . $this->options['liSymbolHeight'] . '|' . WP_CONTENT_DIR . '/uploads/' . $this->options['liSymbolFile'];
         $pdf->setLIsymbol($lisymbol);
     }
     // 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($this->options['contentFont'], '', $this->options['contentFontSize'], '', true);
     // Add a page
     // This method has several options, check the source code documentation for more information.
     $pdf->AddPage();
     // Apply global css, if set in config
     if ($this->options['applyCSS']) {
         $html .= '<style>' . $this->options['customCss'] . '</style>';
     }
     // Set some content to print
     $html .= '<h1>' . html_entity_decode($post->post_title, ENT_QUOTES) . '</h1>';
     // Display author name is set in config
     if (isset($this->options['authorDetail']) and !$this->options['authorDetail'] == '') {
         $author = get_the_author_meta($this->options['authorDetail'], $post->post_author);
         $html .= '<p><strong>Author : </strong>' . $author . '</p>';
     }
     // Display category list is set in config
     if (isset($this->options['postCategories'])) {
         $categories = get_the_category_list(', ', '', $post);
         if ($categories) {
             $html .= '<p><strong>Categories : </strong>' . $categories . '</p>';
         }
     }
     // Display tag list is set in config
     if (isset($this->options['postTags'])) {
         $tags = get_the_tags($post->the_tags);
         if ($tags) {
             $html .= '<p><strong>Tagged as : </strong>';
             foreach ($tags as $tag) {
                 $tag_link = get_tag_link($tag->term_id);
                 $html .= '<a href="' . $tag_link . '">' . $tag->name . '</a>';
                 if (next($tags)) {
                     $html .= ', ';
                 }
             }
             $html .= '</p>';
         }
     }
     // Display date if set in config
     if (isset($this->options['postDate'])) {
         $date = get_the_date($post->the_date);
         $html .= '<p><strong>Date : </strong>' . $date . '</p>';
     }
     // Display featured image if set in config and post/page
     if (isset($this->options['featuredImage'])) {
         if (has_post_thumbnail($post->ID)) {
             $html .= get_the_post_thumbnail($post->ID);
         }
     }
     $html .= htmlspecialchars_decode(htmlentities($post->post_content, ENT_NOQUOTES, 'UTF-8', false), ENT_NOQUOTES);
     $dom = new simple_html_dom();
     $dom->load($html);
     foreach ($dom->find('img') as $e) {
         // Try to respect alignment of images
         // This code is under heavy development, so well-commented
         // First, try to determine the desired alignment from the class attribute inserted by WP.
         // Note that as we're still working with HTML vs CSS, and HTML uses "middle" for center, we
         // have two variables to fill for that possibility.
         if (preg_match('/alignleft/i', $e->class)) {
             $imgalign = 'left';
         } elseif (preg_match('/alignright/i', $e->class)) {
             $imgalign = 'right';
         } elseif (preg_match('/aligncenter/i', $e->class)) {
             $imgalign = 'center';
             $htmlimgalign = 'middle';
         } else {
             $imgalign = 'none';
         }
         // These options apply to all images. Remove any embedded class, which is ignored by TCPDF, anyway;
         // then set an align attribute inside the img tag (for HTML), and finally, a style tag (for CSS).
         $e->class = null;
         $e->align = $imgalign;
         if (isset($htmlimgalign)) {
             $e->style = 'float:' . $htmlimgalign;
         } else {
             $e->style = 'float:' . $imgalign;
         }
         // Try to identify SVG images vs JPG or PNG, so that we treat them correctly. Currently, we don't
         // handle these well, so we'll just swap them with placeholder links.
         // Note that we're still using div tags to (harshly) force images into some semblance of horizontal
         // position. This precludes text wrap, and ultimately (if we can get the above working) should be
         // replaced (unless we need the text link) with the CSS in the img tag (if TCPDF will respect it).
         if (strtolower(substr($e->src, -4)) == '.svg') {
             $e->src = null;
             $e->outertext = '<div style="text-align:' . $imgalign . '">[ SVG: ' . $e->alt . ' ]</div><br/>';
         } else {
             $e->outertext = '<div style="text-align:' . $imgalign . '">' . $e->outertext . '</div>';
         }
     }
     $html = $dom->save();
     $dom->clear();
     // Test TCPDF functions to include here.
     // Presently, we're working with trying to get PDF forms working. These options should go into the admin UI.
     // set default form properties
     $pdf->setFormDefaultProp(array('lineWidth' => 1, 'borderStyle' => 'solid', 'fillColor' => array(255, 255, 200), 'strokeColor' => array(255, 128, 128)));
     // Print text using writeHTML
     $pdf->writeHTML($html, true, 0, true, 0);
     // ---------------------------------------------------------
     // Close and output PDF document
     // This method has several options, check the source code documentation for more information.
     // Create directory if not exist
     if (!is_dir(WPPTOPDFENH_CACHE_DIR)) {
         mkdir(WPPTOPDFENH_CACHE_DIR, 0777, true);
     }
     if ($forceDownload) {
         $pdf->Output($filePath, 'FI');
     } else {
         $pdf->Output($filePath, 'F');
     }
 }
            echo $item_summary;
            ?>
</td>
			</tr>		
			<?php 
        }
    } else {
        echo '<p>No Inspection Items available.</p>';
    }
    ?>
	</table>
	<?php 
    $pdf_contents = ob_get_contents();
    // echo $pdf_contents;die;
    ob_end_clean();
    $pdf->writeHTML($pdf_contents, true, false, true, false, '');
    // Close and output PDF document
    // This method has several options, check the source code documentation for more information. //
    $pdf->Output('pdf_inspection_' . $consultant_id . "_" . $client_id . '.pdf', 'D');
}
?>
</div><!--end div homebg-->

<!-- PRINT advanced inspection Modal --> 
<div id="modal_print_contents" style="width:800px;margin-left:-400px;" class="modal fade hide metro" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-header bg-red"><h3 id="myModalLabel">Advanced Inspection<i class="pull-right icon-cancel-2" style="margin-right:10px;" data-dismiss="modal"></i></h3></div>
	<div class="modal-body">
	<div class="charities-container" id="id_print_contents" style="padding:0px 0px 0px 0px;box-shadow: none;">
		<?php 
// Consultant profile Image //
if (file_exists(FCPATH . $this->path_upload_profiles . $user['profile_image'])) {
Example #20
0
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
//-----------------------------
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(10, 19, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetAutoPageBreak(true, 0);
// set auto page breaks
//    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set font
$pdf->SetFont('helvetica', '', 6.5);
$pdf->Addpage();
$pdf->writeHTML($contenido, true, false, false, false, '');
if ($marcaAgua === '1') {
    // get the current page break margin
    $bMargin = $pdf->getBreakMargin();
    // get current auto-page-break mode
    $auto_page_break = $pdf->getAutoPageBreak();
    // disable auto-page-break
    $pdf->SetAutoPageBreak(false, 0);
    // set bacground image
    $img_file = K_PATH_IMAGES . 'marcaAgua.jpg';
    $pdf->SetAlpha(0.1);
    $pdf->Image($img_file, 0, 0, 280, 200, '', '', '', false, 300, 'C', false, false, 0);
    $pdf->SetAlpha(1);
    // restore auto-page-break status
    $pdf->SetAutoPageBreak($auto_page_break, $bMargin);
    // set the starting point for the page content
Example #21
0
            }
        }
    }
}
if ($varFT > 0) {
    $inicio_tabla_nomProyecto .= "<tr>\r\n        <td class=\"celdaTablaFicha encabezado\" colspan=\"2\">FACTIBILIDAD T&Eacute;CNICA:</td>  \r\n        <td class=\"celdaTablaFicha\" colspan=\"5\">";
    $fT = trim($fT, ", ");
    $inicio_tabla_nomProyecto .= $fT . "</td>";
    $inicio_tabla_nomProyecto .= "</tr>";
}
$inicio_tabla_nomProyecto .= "</table>";
$html = <<<EOD
{$estilo_tabla}
{$inicio_tabla_nomProyecto}
EOD;
$pdf->writeHTML($html, true, false, false, false, '');
$pdf->Ln(5);
$row_responsable = "";
$row_responsable .= "\r\n                <tr nobr=\"true\">\r\n                   <td></td>\r\n                   <td align=\"center\"><FONT SIZE=\"9\">Nombre y Firma del Responsable</font></td>\r\n                   <td></td>\r\n                </tr>";
$responsable = <<<EOD
    <table border="0" class="general">
        <tr>        
            <th width="150"></th>
            <th width="325"><hr color="black" size=2></th>
            <th width="150"></th>
        </tr>
        {$row_responsable}
    </table>
        {$estilo_tabla}
EOD;
$pdf->writeHTML($responsable, true, false, false, false, '');
Example #22
0
$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 default font subsetting mode
$pdf->setFontSubsetting(true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// output the HTML content
$pdf->writeHTML($asu, true, false, true, false, '');
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output($ruta_raiz . $ruta2, 'F');
//respuesta rapida adjunta al correo
//$mail->AddAttachment($ruta_raiz.$ruta2);
if (!empty($mail->ErrorInfo)) {
    $errores .= empty($errores) ? "&error=10" : '-10';
}
//radicado padre adjunto al correo
$post = strpos(strtolower($pathPadre), 'bodega');
if ($post !== false) {
    $pathPadre = substr($pathPadre, $post + 6);
}
$rutaPadre = $ruta_raiz . 'bodega/' . $pathPadre;
Example #23
0
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//GET DATA FROM URL
$id = $_GET['id'];
$data_i = $_GET['data_i'];
$data_f = $_GET['data_f'];
// SQL Query
$result = mysqli_query($con, "SELECT data, operatore, (ore_std + ore_extra + ore_fest + ore_sabato) as total FROM co_ore  WHERE id_commessa='{$id}' AND data BETWEEN '{$data_i}' AND '{$data_f}'");
while ($row = mysqli_fetch_array($result)) {
    $orderdate = explode('-', $row['data']);
    $data = $orderdate[2] . "/" . $orderdate[1] . "/" . $orderdate[0];
    $operatore = $row['operatore'];
    $total = $row['total'];
    if ($i % 2 == 0) {
        $color_row = "aliceblue";
        $i++;
    } else {
        $color_row = "white";
        $i++;
    }
    $tbl .= '<tr style="background-color:' . $color_row . '"><td>' . $data . '</td><td>' . $operatore . '</td><td>' . $total . '</td></tr>';
}
// Print text using writeHTMLCell()
$pdf->writeHTML($tbl_header . $tbl . $tbl_footer, true, false, false, false, '');
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('report.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Example #24
0
$dir = realpath("../snippets");
/* target pdf */
$pdfFile = "snippet-list.pdf";
$rand = substr(md5(rand()), 0, 8);
$dirTarget = realpath("../tmp") . "/" . $rand . "/";
$url = "tmp/" . $rand . "/" . $pdfFile;
mkdir($dirTarget);
/* La configuration */
$config = array('author' => 'Rodolphe', 'title' => 'Snippet Generator', 'source' => 'http://rodbox.fr/snippet', 'file' => $pdfFile, 'date' => '<strong>' . date("d-m-Y") . '</strong> ' . date("H:i"), 'unit' => 'mm', 'marginTop' => $_GET["marginTop"], 'marginBottom' => $_GET["marginBottom"], 'marginLeft' => $_GET["marginLeft"], 'marginRight' => $_GET["marginRight"], 'fontSizeRatio' => $_GET["fontSizeRatio"], 'nbCol' => $_GET["nbCol"], 'strLimit' => $_GET["strLimit"], 'tcellpadding' => $_GET["tcellpadding"] * $_GET["fontSizeRatio"], 'format' => $_GET["format"], 'orientation' => $_GET["orientation"], 'fontSize_1' => 7 * $_GET["fontSizeRatio"], 'fontSize_2' => 5 * $_GET["fontSizeRatio"], 'color_1' => '#a2a2a2', 'color_2' => '#696969', 'tborder' => 1 * $_GET["fontSizeRatio"]);
$i = 1;
// create new PDF document
$pdf = new MYPDF();
/* On charge la configuration par défault */
$pdf->setConfig($config);
/* On execute les fonctions par défault a partir de la config*/
$pdf->setDefault();
/*On crée la page */
$pdf->AddPage();
/* On inclue le fichier de contenue qui renvois $html */
include "../includes/pdf-content.php";
/* On ecrit le contenue du pdf */
$pdf->writeHTML($html, false, false, true, false);
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output($dirTarget . $pdfFile, 'F');
$r = array('infotype' => "success", 'msg' => "ok", 'data' => ['url' => $url]);
echo json_encode($r);
//============================================================+
// END OF FILE
//============================================================+
Example #25
0
 function generatePdfReport($pdfData, $mode, $params, $fileName)
 {
     $countries = CJFunctions::get_country_names();
     $responses = array();
     $include_email_in_reports = $params->get('include_email_in_reports', 0);
     foreach ($pdfData->responses as $response) {
         $responses[$response->id] = new stdClass();
         $responses[$response->id]->created_by = $response->created_by;
         $responses[$response->id]->created = $response->created;
         $responses[$response->id]->username = $response->username;
         $responses[$response->id]->name = $response->name;
         if ($include_email_in_reports == 1) {
             $responses[$response->id]->email = $response->email;
         }
         $responses[$response->id]->questions = array();
         foreach ($pdfData->questions as $question) {
             $responses[$response->id]->questions[$question->id] = new stdClass();
             $responses[$response->id]->questions[$question->id]->answer = '';
             $responses[$response->id]->questions[$question->id]->question_type = $question->question_type;
         }
     }
     if (!empty($pdfData->entries)) {
         foreach ($pdfData->entries as $entry) {
             if (isset($responses[$entry->response_id]) && isset($responses[$entry->response_id]->questions[$entry->question_id])) {
                 if (!empty($entry->answer)) {
                     if (empty($responses[$entry->response_id]->questions[$entry->question_id]->answer)) {
                         $responses[$entry->response_id]->questions[$entry->question_id]->answer = $entry->answer;
                     } else {
                         $responses[$entry->response_id]->questions[$entry->question_id]->answer .= '<br/>' . $entry->answer;
                     }
                     if (!empty($entry->answer_image) && JFile::exists(S_IMAGES_UPLOAD_DIR . '/' . $entry->answer_image)) {
                         //$image = JHtml::image(JURI::root(true).'/media/communitysurveys/images/'.$entry->answer_image, $entry->answer);
                         $image = '<img src="' . JURI::root(true) . '/media/communitysurveys/images/' . $entry->answer_image . '">';
                         $responses[$entry->response_id]->questions[$entry->question_id]->answer .= '<br/>' . $image;
                     }
                 }
                 if (!empty($entry->answer2)) {
                     if (empty($responses[$entry->response_id]->questions[$entry->question_id]->answer)) {
                         $responses[$entry->response_id]->questions[$entry->question_id]->answer = $entry->answer2;
                     } else {
                         $responses[$entry->response_id]->questions[$entry->question_id]->answer .= '<br/>' . $entry->answer2;
                     }
                 }
                 if (!empty($entry->free_text)) {
                     // do special types formatting //
                     if ($responses[$entry->response_id]->questions[$entry->question_id]->question_type == S_SPECIAL_NAME) {
                         $names = explode('|', $entry->free_text);
                         if (!empty($names)) {
                             $entry->free_text = $names[0] . '. ' . $names[1] . ' ' . $names[2];
                         } else {
                             $entry->free_text = '';
                         }
                     } else {
                         if ($responses[$entry->response_id]->questions[$entry->question_id]->question_type == S_SPECIAL_ADDRESS) {
                             $parts = explode('|||', $entry->free_text);
                             if (count($parts) == 7) {
                                 $entry->free_text = '<address><strong>' . CJFunctions::escape($parts[0]) . '</strong><br>';
                                 $entry->free_text .= CJFunctions::escape($parts[1]) . '<br>';
                                 if (!empty($parts[2])) {
                                     $entry->free_text .= CJFunctions::escape($parts[2]) . '<br>';
                                 }
                                 $entry->free_text .= CJFunctions::escape($parts[3]) . ', ' . CJFunctions::escape($parts[4]) . ', ' . CJFunctions::escape($parts[6]) . '<br>';
                                 $entry->free_text .= !empty($countries[$parts[5]]) ? $countries[$parts[5]]->country_name : CJFunctions::escape($parts[5]);
                             } else {
                                 $entry->free_text = '';
                             }
                         }
                     }
                     // do special types formatting //
                     if (empty($responses[$entry->response_id]->questions[$entry->question_id]->answer)) {
                         $responses[$entry->response_id]->questions[$entry->question_id]->answer = $entry->free_text;
                     } else {
                         $responses[$entry->response_id]->questions[$entry->question_id]->answer .= '<br/>' . $entry->free_text;
                     }
                 }
             }
         }
     }
     $response_rows = array();
     foreach ($responses as $id => $response) {
         $string = '<table class="table table-striped" width="100%">';
         $string = $string . '<tr><th width="30%"><strong>Response ID:</strong></th><td width="70%">' . $id . '</td></tr>';
         $string = $string . '<tr><th><strong>Response Date:</strong></th><td>' . $response->created . '</td></tr>';
         $string = $string . '<tr><th><strong>User ID:</strong></th><td>' . $response->created_by . '</td></tr>';
         $string = $string . '<tr><th><strong>Username:</strong></th><td>' . $response->username . '</td></tr>';
         $string = $string . '<tr><th><strong>User Display Name:</strong></th><td>' . $response->name . '</td></tr>';
         if ($include_email_in_reports == 1) {
             $string = $string . '<tr><td><strong>Email:</strong></td><td>' . $response->email . '</td></tr>';
         }
         foreach ($pdfData->questions as $question) {
             $string = $string . '<tr><td colspan="2">&nbsp;<hr></td></tr>';
             $string = $string . '<tr><th colspan="2"><h3>' . $question->title . '</h3></th></tr>';
             if (!empty($question->description)) {
                 $string = $string . '<tr><td colspan="2">' . $question->description . '</td></tr>';
             }
             $string = $string . '<tr><td colspan="2">&nbsp;</td></tr>';
             $string = $string . '<tr><td colspan="2">' . $response->questions[$question->id]->answer . '</td></tr>';
         }
         $string = $string . '</table>';
         array_push($response_rows, $string);
     }
     // 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, $pdfData->title, '');
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('corejoomla.com');
     $pdf->SetTitle('Survey Report');
     $pdf->SetSubject('Survey Responses 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');
     foreach ($response_rows as $i => $response) {
         $pdf->AddPage();
         $pdf->writeHTML($response, true, false, true, false, '');
         $pdf->lastPage();
     }
     $pdf->Output($fileName, $mode);
 }
Example #26
0
 public function actionCreateAccount()
 {
     $params = self::accountCond();
     $select1 = "OrderSN as No,CreateTime,Payment,BuyerID,RealPrice as Price,BuyerName";
     $select2 = "ReturnNO as No,CreateTime,PayMethod as Payment,ServiceID as BuyerID,Price";
     if ($params['type'] == 1) {
         $seaCon1 = "select {$select1} from pap_order t where t.Status=9";
         $seaCon1 .= " and SellerID = {$params['OrganID']} and IsDelete = 0";
         $seaCon1 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}";
         $seaCon1 .= " order by CreateTime DESC";
         $data1 = Yii::app()->papdb->createCommand($seaCon1)->queryAll();
         $count1 = Yii::app()->papdb->createCommand(str_replace($select1, 'sum(RealPrice)', $seaCon1))->queryScalar();
     } else {
         if ($params['type'] == 2) {
             $seaCon2 = "select {$select2} from pap_return_order t where t.Status in(4,14)";
             $seaCon2 .= " and DealerID = {$params['OrganID']}";
             $seaCon2 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}";
             $seaCon2 .= " order by CreateTime DESC";
             $data2 = Yii::app()->papdb->createCommand($seaCon2)->queryAll();
             $count2 = Yii::app()->papdb->createCommand(str_replace($select2, 'sum(Price)', $seaCon2))->queryScalar();
         } else {
             $seaCon1 = "select {$select1} from pap_order t where t.Status=9";
             $seaCon1 .= " and SellerID = {$params['OrganID']} and IsDelete = 0";
             $seaCon1 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}";
             $seaCon1 .= " order by CreateTime DESC";
             $data1 = Yii::app()->papdb->createCommand($seaCon1)->queryAll();
             $count1 = Yii::app()->papdb->createCommand(str_replace($select1, 'sum(RealPrice)', $seaCon1))->queryScalar();
             $seaCon2 = "select {$select2} from pap_return_order t where t.Status in(4,14)";
             $seaCon2 .= " and DealerID = {$params['OrganID']}";
             $seaCon2 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}";
             $seaCon2 .= " order by CreateTime DESC";
             $data2 = Yii::app()->papdb->createCommand($seaCon2)->queryAll();
             $count2 = Yii::app()->papdb->createCommand(str_replace($select2, 'sum(Price)', $seaCon2))->queryScalar();
         }
     }
     $count1 = $count1 ? $count1 : 0;
     $count2 = $count2 ? $count2 : 0;
     $gain = $count1 - $count2;
     $day = date('t', $params['starttime']);
     $organ = Organ::model()->findByPk($params['OrganID'], array('select' => 'OrganName'))->attributes;
     $html = '<div style="height:24px; line-height:24px; background-color:#1f76c8">
             <div style="margin:0 auto; text-align:center">
             <span style="font-family:微软雅黑; font-size:24px; color:#fff; word-spacing:8px; letter-spacing: 1.5px;">' . $params['uyear'] . '年' . $params['umonth'] . '月对账单</span>
             </div>
         </div>
         <div style="font-size:16px; color:#343434; line-height:16px">
             <p style="margin:0px; ">亲爱的' . $organ['OrganName'] . ',您好!</p>
             <p style="margin:0px; ">感谢您使用由你配平台,以下是您' . $params['umonth'] . '月的平台交易明细:</p>
         </div>
         <div style="height:20px; line-height:18px; border-bottom:2px solid #c9c7c7; border-top:2px solid #c9c7c7; background-color:#f2f2f2; padding:0 30px">
             <div style="font-size:16px; font-weight:bold; color:#565656; line-height:18px;float:left">
                 本月净收益: <span style="color:#1f76c8">' . $gain . '</span> 元
             </div>
             <div style="font-size:16px; line-height:18px;float:right">
                 <p style="margin:0px; line-height:15px">
                 	本月总收入: <span style="color:#1f76c8;font-size:14px">' . $count1 . '</span>元
                    	&nbsp;&nbsp;
                    	本月总支出: <span style="color:#1f76c8;font-size:14px">' . $count2 . '</span>元</p>
                 <p style="margin:0px; line-height:15px">
                 	账单周期:' . $params['uyear'] . '年' . $params['umonth'] . '月01日—' . $params['uyear'] . '年' . $params['umonth'] . '月' . $day . '日
                 </p>
     </div>
     </div>';
     Yii::import('application.extensions.tcpdf.*');
     // create new PDF document
     $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // 设置文档信息
     $pdf->SetCreator('--');
     $pdf->SetAuthor('北京嘉配科技有限公司');
     $pdf->SetTitle('由你配 - 对账单');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, PHP');
     // 设置页眉和页脚信恿
     $pdf->SetHeaderData('', 30, '', '', array(0, 64, 255), array(0, 64, 128));
     $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
     // 设置页眉和页脚字使
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // 设置默认等宽字体
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // 设置间距
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // 设置分页
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // 设置字体
     $pdf->SetFont('stsongstdlight', '', 14, true);
     // 添加页面
     $pdf->AddPage();
     // Image example with resizing
     $pdf->Image(F::themeUrl() . '/images/jpd/logo_account.jpg', 20, 28, 30, 18, 'JPG', '', '', true, 150, '', false, false, 0, false, false, false);
     // 设置字体阴影
     //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
     // 输出HTML内容
     $pdf->writeHTML($html, true, false, true, false, '');
     if (!empty($data1)) {
         $html = '<p style="color:#1f76c8">订单明细:</p>';
         $pdf->writeHTML($html, true, false, true, false, '');
         // 表格标题
         $header = array('时间', '交易类型', '修理厂名称', '订单编号', '收入(元)');
         // data loading
         $data = array();
         foreach ($data1 as $key => $val) {
             $data[$key][0] = date('Y-m-d', $val['CreateTime']);
             $data[$key][1] = $val['Payment'] == 2 ? '物流代收款' : '支付宝担保';
             if (!$val['BuyerName']) {
                 $val['BuyerName'] = Organ::model()->findByPk($val['BuyerID'], array('select' => 'OrganName'))->attributes['OrganName'];
             }
             $data[$key][2] = $val['BuyerName'];
             $data[$key][3] = $val['No'];
             $data[$key][4] = $val['Price'];
         }
         // 输出表格
         $pdf->ColoredTable($header, $data);
         //换行
         $pdf->Ln();
     }
     if (!empty($data2)) {
         $html = '<p style="color:#1f76c8;">退货明细:</p>';
         $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
         // 表格标题
         $header = array('时间', '退款方式', '修理厂名称', '退货单号', '支出(元)');
         // 导入数据
         $data = array();
         foreach ($data2 as $key => $val) {
             $data[$key][0] = date('Y-m-d', $val['CreateTime']);
             $data[$key][1] = $val['Payment'] == 1 ? '物流代收款' : '支付宝担保';
             $data[$key][2] = Organ::model()->findByPk($val['BuyerID'], array('select' => 'OrganName'))->attributes['OrganName'];
             $data[$key][3] = $val['No'];
             $data[$key][4] = $val['Price'];
         }
         // 输出表格
         $pdf->ColoredTable($header, $data);
     }
     $pdf->Output('Account.pdf', 'I');
 }
Example #27
0
for ($i = 0; $i < count($_POST['idSol']); $i++) {
    $cuerpo .= "<tr>";
    $cuerpo .= "<td>" . $_POST['idSol'][$i] . "</td><td>" . $_POST['ue'][$i] . "</td><td>" . $_POST['tipo'][$i] . "</td>";
    $cuerpo .= "</tr>";
}
$cuerpo = utf8_encode($cuerpo);
//echo $cuerpo;
// -----------------------------------------------------------------------------
$tbl = <<<EOD
<table border="0" cellpadding="2" cellspacing="2" align="center" width= "100%">

<tr>
  <th colspan="3">TURNADO A DIRECCIONES DE ÁREA</th>
 </tr>
        <tr>
  <th colspan="3">TURNO:<span class="text">{$turno}</span></th>
 </tr>
<tr><td colspan="1"><span class="head">Turnado a: </span><span class="text">{$area}</span></td><td colspan="2"><span class="head">Fecha: </span><span class="text">{$fechaTurno}</span><br><span class="head">Turnada por: </span><span class="text">Ventanilla</span></td></tr>
     
 <tr>
  <td width= "25%">NUM. SOLICITUD</td>
  <td width= "45%">UNIDAD EJECUTORA</td>
  <td width= "30%">TIPO DE SOLICITUD</td>
 </tr>
    {$cuerpo}
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
// -----------------------------------------------------------------------------
//Close and output PDF document
$pdf->Output('turnoExpedientes' . $turno . '.pdf', 'I');
Example #28
0
  * @author Nicola Asuni
  * @since 2008-03-04
  */
 /* La configuration */
 $config = array('author' => $json["author"], 'title' => $json["title"], 'source' => $json["source"], 'file' => $pdfFile, 'date' => '<strong>' . date("d-m-Y") . '</strong> ' . date("H:i"), 'unit' => 'mm', 'marginTop' => $json["marginTop"], 'marginBottom' => $json["marginBottom"], 'marginLeft' => $json["marginLeft"], 'marginRight' => $json["marginRight"], 'fontSizeRatio' => $json["fontSizeRatio"], 'nbCol' => $json["nbCol"], 'strLimit' => $json["strLimit"], 'tcellpadding' => $json["tcellpadding"] * $json["fontSizeRatio"], 'format' => $json["format"], 'orientation' => $json["orientation"], 'fontSize_1' => 7 * $json["fontSizeRatio"], 'fontSize_2' => 5 * $json["fontSizeRatio"], 'color_1' => '#a2a2a2', 'color_2' => '#696969', 'fileSrc' => isset($json['fileSrc']) ? $json['fileSrc'] : false, 'authorSrc' => isset($json['authorSrc']) ? $json['authorSrc'] : false, 'dateSrc' => isset($json['dateSrc']) ? $json['dateSrc'] : false, 'generateSrc' => isset($json['generateSrc']) ? $json['generateSrc'] : false, 'filePage' => isset($json['filePage']) ? $json['filePage'] : false, 'cHeader' => $json["cHeader"], 'bgHeader' => $json["bgHeader"], 'cFooter' => $json["cFooter"], 'bgFooter' => $json["bgFooter"], 'cContent' => $json["cContent"], 'bgContent' => $json["bgContent"], 'palette' => $palette, 'tborder' => 1 * $json["fontSizeRatio"], 'docHeader' => "<style>" . $css . "</style>" . $json["docHeader"]);
 $i = 1;
 // create new PDF document
 $pdf = new MYPDF();
 /* On charge la configuration par défault */
 $pdf->setConfig($config);
 /* On execute les fonctions par défault a partir de la config*/
 $pdf->setDefault();
 /*On crée la page */
 $pdf->AddPage();
 /* On ecrit le contenue du pdf */
 $pdf->writeHTML($html, false, false, true, false);
 if (isset($json["style-export-show"]) && $json["style-export-show"]) {
     /* CSS AFFICHAGE */
     $cssContent = '<pre class="c-9">';
     $cssContent .= $css;
     $cssContent .= "</pre>";
     // $html = "";
     $pdf->AddPage();
     /* On ecrit le contenue du pdf */
     $pdf->writeHTML($cssContent, false, false, true, false);
 }
 // ---------------------------------------------------------
 // Close and output PDF document
 // This method has several options, check the source code documentation for more information.
 // $pdf->Output($dirTarget.$pdfFile, 'F');
 $pdf->Output($pdfDir, 'FI');
    $pdf->Cell(0, 0, $line, 0, 1);
}
$pdf->SetFont('helvetica', '', 8);
$pdf->ln();
$pdf->Cell(0, 0, $SPECIAL_NOTE, 0, 1);
$pdf->ln();
// ---------------------------------------------------------
$pdf->SetY(90);
$pdf->SetFont('helvetica', '', 12);
$pdf->Image($HEADER_IMG, $pdf->GetX(), $pdf->GetY(), $W, '', 'png', '', 'T', true, 300, '', false, false, 0, true, false, false);
$pdf->SetY(120);
$pdf->SetFont('helvetica', 'B', 14);
$pdf->Cell(0, 0, "Letter of Attendance", 0, 1);
$pdf->SetY(140);
$pdf->SetFont('helvetica', '', 12);
$pdf->writeHTML($HTML, true, false, true, false, '');
$SIGPOS = 200;
$SIGOFF = 20;
$pdf->SetY($SIGPOS);
$pdf->SetFont('helvetica', '', 12);
$pdf->Cell(0, 0, "Sincerely,", 0, 1);
$pdf->SetY($SIGPOS + 30);
$pdf->Cell(0, 0, $SIGNATURE_IMGPERS[0], 0, 1);
$pdf->SetFont('helvetica', '', 8);
$pdf->Cell(0, 0, $SIGNATURE_IMGPERS[1], 0, 1);
$pdf->Image($SIGNATURE_IMG, $LM - 5, $SIGPOS + 30 - $SIGOFF, "", $SIGOFF, 'png', '', 'T', true, 300, '', false, false, 0, true, false, false);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output($FILENAME, 'I');
//============================================================+
// END OF FILE
Example #30
0
 function topdf()
 {
     $this->service_id = $_POST['service_id'];
     $this->startTime = strtotime($_POST['startTime']);
     $this->endTime = strtotime($_POST['endTime']);
     $this->time_type = $_POST['time_type'];
     require_once Kohana::find_file('helpers', 'tcpdf/config/lang/eng');
     require_once Kohana::find_file('helpers', 'tcpdf/mypdf');
     $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator("uooly");
     $pdf->SetAuthor('上海雍立信息科技有限公司');
     $pdf->SetTitle('雍立ASM应用安全审计报表');
     $pdf->SetSubject('雍立ASM应用安全审计报表');
     $logo_img = '../../../../assets/images/logo.png';
     $logo_width = 15;
     $header_title = "雍立ASM应用安全审计";
     $header_string = "2010年度报表";
     $pdf->SetHeaderData($logo_img, $logo_width, $header_title, $header_string);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->setLanguageArray($l);
     $pdf->AddPage();
     $pdf->SetFont('stsongstdlight', '', 10);
     if (!$this->client_ip) {
         $client_ip = "所有IP地址";
     }
     if (!$this->user_name) {
         $user_name = "所有用户";
     }
     if (!$this->criticality) {
         $criticality = "所有严重级别";
     }
     if (!$this->operation) {
         $operation = "所有操作";
     }
     $startTime = date("Y-m-d H:i:s", $this->startTime);
     $endTime = date("Y-m-d H:i:s", $this->endTime);
     switch ($this->time_type) {
         case "day":
             $chart_type = "日报";
             break;
         case "week":
             $chart_type = "周报";
             break;
         case "month":
             $chart_type = "月报";
             break;
         case "year":
             $chart_type = "年报";
             break;
     }
     $tbl = "<h1>hello world</h1>";
     $tbl = "<div>";
     $tbl .= '<table border="1" id="summary_table">';
     $tbl .= '<tr>';
     $tbl .= '<th colspan=2>统计条件</th>';
     $tbl .= '</tr>';
     $tbl .= '<tr>';
     $tbl .= '<td>时间段包含</td>';
     $tbl .= "<td>{$startTime} 至 {$endTime}</td>";
     $tbl .= '</tr>';
     $tbl .= '<tr>';
     $tbl .= '<td>客户端包括</td>';
     $tbl .= "<td>{$client_ip}</td>";
     $tbl .= '</tr>';
     $tbl .= '<tr>';
     $tbl .= '<td><font color="red">用户名包括</font></td>';
     $tbl .= "<td>{$user_name}</td>";
     $tbl .= '</tr>';
     $tbl .= '<tr>';
     $tbl .= '<td>操作包括</td>';
     $tbl .= "<td>{$operation}</td>";
     $tbl .= '</tr>';
     $tbl .= '<tr>';
     $tbl .= '<td>紧急程度</td>';
     $tbl .= "<td>{$criticality}</td>";
     $tbl .= '</tr>';
     $tbl .= '</table>';
     $tbl .= "</div>";
     $tbl .= "<div>";
     $tbl .= '<img src="assets/export/stacked.jpg" width="500" height="310">';
     $tbl .= "</div>";
     $tbl .= "<div>";
     $tbl .= '<img src="assets/export/1_clientip_column2d.jpg" width="500" height="310">';
     $tbl .= "</div>";
     $tbl .= "<div>";
     $tbl .= '<img src="assets/export/1_username_column2d.jpg" width="500" height="310">';
     $tbl .= "</div>";
     $tbl .= "<div>";
     $tbl .= '<img src="assets/export/1_operation_column2d.jpg" width="500" height="310">';
     $tbl .= "</div>";
     $pdf->writeHTML($tbl, true, false, false, false, '');
     $pdf->Output('example_038.pdf', 'I');
 }