"); //============================================================+ // File name : example_007.php // Begin : 2008-03-04 // Last Update : 2013-05-14 // // Description : Example 007 for TCPDF class // Two independent columns with WriteHTMLCell() // // Author: Nicola Asuni // // (c) Copyright: // Nicola Asuni // Tecnick.com LTD // www.tecnick.com // info@tecnick.com //============================================================+ /** * Creates an example PDF TEST document using TCPDF * @package com.tecnick.tcpdf * @abstract TCPDF - Example: Two independent columns with WriteHTMLCell() * @author Nicola Asuni * @since 2008-03-04 */ // Include the main TCPDF library (search for installation path). require_once('../extensions/ki_changerequest/templates/tcpdf/tcpdf.php'); // 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 028'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(10, PDF_MARGIN_TOP, 10); // 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); } // --------------------------------------------------------- $pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone'); // set font $pdf->SetFont('times', 'B', 20); $pdf->AddPage('P', 'A4'); $column_company_name = "

Company Name

"; $query = "select k.knd_name as 'company_name' from kimai15_knd k where k.knd_trash = 0 order by k.knd_name"; $result = mysqli_query($con, $query); if (mysqli_num_rows($result) != 0) { while ($row = mysqli_fetch_array($result)) { $column_company_name .= '" . $row['company_name'] . "
" . "\n"; } } $column_project_name = "

Project Name

"; $query = "select DISTINCT right(p.pct_name,CHAR_LENGTH(p.pct_name) - 8 ) as 'project_name' from kimai15_pct p where p.pct_trash = 0 order by project_name"; $result = mysqli_query($con, $query); if (mysqli_num_rows($result) != 0) { while ($row = mysqli_fetch_array($result)) { $column_project_name .= '" . $row['project_name'] . "
" . "\n"; } } $column_division_name = "

Divisions

"; $query = "select DISTINCT left(p.pct_name,3) as 'pdivision_name' from kimai15_pct p where p.pct_trash = 0 order by division_name"; $result = mysqli_query($con, $query); if (mysqli_num_rows($result) != 0) { while ($row = mysqli_fetch_array($result)) { $column_division_name .= '" . $row['division_name'] . "
" . "\n"; } } // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) // get current vertical position $y = $pdf->getY(); // write the first column $pdf->writeHTMLCell(30, '', '', $y, $column_company_name, 1, 0, 0, false, 'L', true); // write the second column $pdf->writeHTMLCell(30, '', '', '', $column_project_name, 1, 0, 0, false, 'L', false); // write the third column $pdf->writeHTMLCell(45, '', '', '', $column_division_name, 1, 1, 0, false, 'L', false); $pdf->AddPage('L', 'A4'); $pdf->writeHTMLCell(45, '', '', '', $column_task_name, 1, 1, 0, false, 'L', true); $pdf->lastPage(); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_028.pdf', 'I');