Path : /var/www/html/smart_kpp2_v2/modules/la/tcpdf/
File Upload :
Current File : /var/www/html/smart_kpp2_v2/modules/la/tcpdf/test.php

<?php

// Include the main TCPDF library (search for installation path).
require_once('tcpdf.php');
class MYPDF extends TCPDF {

	//Page header
	public function Header() {
		// Logo
		#$image_file = K_PATH_IMAGES.'logo_example.jpg';
		#$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
		// Set font
		$this->SetFont('thsarabun', 'B', 18);
		// Title
		$this->MultiCell(0, 10, 'ปริมาณการใช้น้ำมันรถแต่ละคัน กิโลเมตร / ลิตร',0,'C');
		$this->MultiCell(0, 10, 'ปีงบประมาณ XXXX',0,'C');
	}

	// Page footer
	public function Footer() {
		// Position at 15 mm from bottom
		$this->SetY(-15);
		// Set font
		$this->SetFont('thsarabun', '', 14);
		// Page number
		$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
	}
}
// create new PDF document
#$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->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('ประดิภาส สุขเสาร์เกิด');
$pdf->SetTitle('รายงานการใช้งานรถ ศูนย์อนามัยที่ 4 ราชบุุรี');
$pdf->SetSubject('การใช้งานรถประจำเดือน');
#$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->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(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);
}
*/
// ---------------------------------------------------------

// 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('thsarabun', '', 14);
// 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'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));

// Set some content to print
$html = <<<EOD
<style>
.border{
	border:1px solid black;
}
.nobottomline{
	border-left:1px solid black;
	border-right:1px solid black;
}
.end{
	border-left:1px solid black;
	border-right:1px solid black;
	border-bottom:1px solid black;
}
</style>
<table cellpadding="0" cellspacing="0" border="0" align="center" >
<tr>
	<td width="90" class="border">ลำดับที่
    </td>
	<td width="400" class="border" >ยี่ห้อ / ทะเบียน
    </td>
	<td width="140" class="border" > น้ำมันเฉลี่ย กิโลเมตร / ลิตร
    </td>
</tr>
<tr>
	<td class="nobottomline">1
    </td>
	<td align="left"  class="nobottomline"> TOYOTA / 500 เลย
    </td>
	<td class="nobottomline"> 3 ก.ม. ต่อ 1 ลิตร
    </td>
</tr>
<tr>
	<td class="end">1
    </td>
	<td align="left" class="end"> TOYOTA / 500 เลย
    </td>
	<td class="end"> 3 ก.ม. ต่อ 1 ลิตร
    </td>
</tr>

</table>
EOD;

// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);

// ---------------------------------------------------------

// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('example_001.pdf', 'I');

//============================================================+
// END OF FILE
//============================================================+