Example #1
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, 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', '', 12);
// add a page
$pdf->AddPage();
//Column titles
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');
//Data loading
$data = $pdf->LoadData('../cache/table_data_demo.txt');
// print colored table
$pdf->ColoredTable($header, $data);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_011.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
function pdfGen($group_name, $mode = NULL, $start_date, $end_date, $stats, $l, $title, $path_www)
{
    global $centreon_path;
    // 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 Reports Module");
    $pdf->SetAuthor(getGeneralOptInfo("pdfreports_report_author"));
    //$pdf->SetAuthor('Fully Automated Nagios');
    $pdfTitle = $title . " " . $group_name;
    //$pdfTitle = "Rapport de supervision du hostgroup ".$group_name;
    $pdf->SetTitle($pdfTitle);
    //$pdf->SetSubject('TCPDF Tutorial');
    //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
    // define default header data
    $header = $title . " " . $group_name;
    //$header = "Rapport de supervision du hostgroup ".$group_name;
    //$ip = $_SERVER['HOSTNAME'];
    $startDate = date("d/m/Y", $start_date);
    $time = time();
    $endDate = date("d/m/Y", $time);
    $string = _("From") . " " . strftime("%A", $start_date) . " " . $startDate . " " . _("to") . " " . strftime("%A", $time) . " " . $endDate . "\n";
    // set default header data
    $pdf->SetHeaderData('../../../img/headers/' . getGeneralOptInfo("pdfreports_report_header_logo"), PDF_HEADER_LOGO_WIDTH, $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', '', 12);
    // add a page
    $pdf->AddPage();
    //Column titles
    $header = array('Status', 'Time', 'Total Time', 'Mean Time', 'Alert');
    // Pie chart Generation
    $piechart_img = pieGen($stats, $mode);
    //Data loading
    $data = $pdf->LoadData($stats);
    // print colored table
    //$pdf->ColoredTable($header, $data,$chart_img);
    if ($mode == "hgs") {
        // Hostgroup
        $pdf->ColoredTable($header, $data, $piechart_img, $path_www);
    } else {
        if ($mode == "sgs") {
            // Servicegroup
            $pdf->ServicesColoredTable($header, $data, $piechart_img, $path_www);
        }
    }
    // ---------------------------------------------------------
    //génération d'un nom de pdf
    $endDay = date("d", $time);
    $endYear = date("Y", $time);
    $endMonth = date("m", $time);
    $pdfDirName = getGeneralOptInfo("pdfreports_path_gen") . $endYear . $endMonth . $endDay . "/";
    $pdfFileName = $pdfDirName . $endYear . "-" . $endMonth . "-" . $endDay . "_" . $group_name . ".pdf";
    if (!is_dir($pdfDirName)) {
        mkdir($pdfDirName);
    }
    //Close and output PDF document
    $pdf->Output($pdfFileName, 'F');
    return $pdfFileName;
}
Example #3
0
$pdf->setLanguageArray($l);
$pdf->SetFont('times', '', 10, '', true);
$pdf->AddPage();
$spacing = -0.01;
$stretching = 75;
$pdf->setFontStretching($stretching);
$pdf->setFontSpacing($spacing);
$titling = <<<EOD
<strong> <font style="font-size:11">Pharmacy Sys</font> </strong> <br> <strong>Official Receipt</strong><br>
Student Center Ground Floor,<br> P.O. Box Private Bag Kabarak, Kenya <br> Tel: +254 702 937 925 <br> E-mail: pharmacysys@yahoo.com 
<br>-----------------------------------------
EOD;
$header = array('Drug', 'Price.', 'Qtty', 'Cost(Kshs.)');
$ddt = <<<EOD
{$time}   
EOD;
$html = <<<EOD
<br>-----------------------------------------
EOD;
$data = $pdf->LoadData('receipts/docs/' . $recNo . '.txt');
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $titling, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true);
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $ddt, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true);
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
$pdf->ColoredTable($header, $data);
$pdf->SetY(-10);
$pdf->Cell(0, 0, 'You were served by: ' . strtoupper($user), 0, false, 'L', 0, '', 0, false, 'T', 'M');
$pdf->Output('receipts/printouts/' . $details1['customer_name'] . '-receipt.pdf', 'F');
unlink('receipts/docs/' . $recNo . '.txt');
unset($_SESSION['custId'], $_SESSION['custName'], $_SESSION['age'], $_SESSION['sex'], $_SESSION['postal_address'], $_SESSION['phone']);
header('Location: payment.php');
exit;
Example #4
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);
// 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 font
$pdf->SetFont('helvetica', '', 12);
// add a page
$pdf->AddPage();
// column titles
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');
// data loading
$data = $pdf->LoadData('data/table_data_demo.txt');
// print colored table
$pdf->ColoredTable($header, $data);
// ---------------------------------------------------------
// close and output PDF document
$pdf->Output('example_011.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Example #5
0
// 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', '', 8);
// add a page
$pdf->AddPage();
//Column titles
$header = array('ID', 'Company Name', 'Area (sq km)', 'Pop. (thousands)');
//Data loading
$data = $pdf->LoadData();
// print colored table
$pdf->ColoredTable($header, $data);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_011.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
?>
>
Example #6
0
$pdf->SetFont('times', '', 10, '', true);
$pdf->AddPage();
$spacing = -0.01;
$stretching = 75;
$pdf->setFontStretching($stretching);
$pdf->setFontSpacing($spacing);
$titling = <<<EOD
<strong> <font style="font-size:11">Pharmacy Sys</font> </strong> <br>
Student Center Ground Floor,<br> P.O. Box Private Bag Kabarak, Kenya <br> Tel: +254 702 937 925 <br> E-mail: pharmacysys@yahoo.com <br>-----------------------------------------
EOD;
$header = array('Drug', 'Strength', 'Dose', 'Quantity', 'Price', 'Total');
$ddt = <<<EOD
<strong>INVOICE N<sup>o</sup>:</strong> {$invoiceNo}  <br>
{$time}   
EOD;
$html = <<<EOD
<strong>Name: </strong> {$cname} <strong>ID N<sup>o</sup>: {$c_id}
<br>-----------------------------------------
EOD;
$data = $pdf->LoadData('receipts/docs/' . $c_id . '.txt');
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $titling, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true);
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $ddt, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true);
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
$pdf->ColoredTable($header, $data);
$pdf->SetY(-10);
$pdf->Cell(0, 0, 'You were served by: ' . strtoupper($user), 0, false, 'L', 0, '', 0, false, 'T', 'M');
$pdf->Output('receipts/printouts/' . $cname . '-invoice.pdf', 'F');
//unlink('receipts/docs/'.$c_id.'.txt');
unset($_SESSION['custId'], $_SESSION['custName'], $_SESSION['age'], $_SESSION['sex'], $_SESSION['postal_address'], $_SESSION['phone']);
header('Location: prescription.php');
exit;
Example #7
0
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set default font subsetting mode
     $pdf->setFontSubsetting(true);
     // Set font
     $pdf->SetFont('helvetica', '', 14, '', true);
     // Add a page
     // This method has several options, check the source code documentation for more information.
     $pdf->AddPage();
     $indexes = getIndexes();
     $pdf->SetY(50);
     // column titles
     $header = array('MES', '$/m²', 'ÍNDICE', 'VARIACIÓN');
     // data loading
     $data = $pdf->LoadData($indexes);
     // print colored table
     $pdf->ColoredTable($header, $data);
     $pdf->Output('indice-general-de-la-construcción.pdf', 'I');
     break;
 case '4':
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set default header data
     $pdf->SetHeaderData('logo.png', 15, "APYMECO", "Índice general de la construcción", array(0, 0, 0), array(0, 0, 0));
     // set header and footer fonts
     $pdf->setHeaderFont(array('helvetica', '', 12));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);