本文整理汇总了PHP中MYPDF::setLanguageArray方法的典型用法代码示例。如果您正苦于以下问题:PHP MYPDF::setLanguageArray方法的具体用法?PHP MYPDF::setLanguageArray怎么用?PHP MYPDF::setLanguageArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MYPDF
的用法示例。
在下文中一共展示了MYPDF::setLanguageArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pdfGen
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;
}
示例2: checkStoreInvoice
//.........这里部分代码省略.........
return 0;
}
if (!empty($invoiceNumberDate[0])) {
$invoiceNumber = $invoiceNumberDate[0];
} else {
$invoiceNumber = FALSE;
}
if (!$invoiceNumber or empty($invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
return 0;
}
if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) {
return 0;
}
$path .= 'vminvoice_' . $invoiceNumber . '.pdf';
if (file_exists($path) and !$force) {
return $path;
}
// $app = JFactory::getApplication('site');
//We come from the be, so we need to load the FE langauge
$jlang = JFactory::getLanguage();
$jlang->load('com_virtuemart', JPATH_SITE, 'en-GB', true);
$jlang->load('com_virtuemart', JPATH_SITE, $jlang->getDefault(), true);
$jlang->load('com_virtuemart', JPATH_SITE, null, true);
$this->addViewPath(JPATH_VM_SITE . DS . 'views');
$format = 'html';
$viewName = 'invoice';
$view = $this->getView($viewName, $format);
$view->addTemplatePath(JPATH_VM_SITE . DS . 'views' . DS . 'invoice' . DS . 'tmpl');
$view->invoiceNumber = $invoiceNumberDate[0];
$view->invoiceDate = $invoiceNumberDate[1];
$view->orderDetails = $orderDetails;
$view->uselayout = 'invoice';
ob_start();
$view->display();
$html = ob_get_contents();
ob_end_clean();
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator('Invoice by VirtueMart 2, used library tcpdf');
$pdf->SetAuthor($view->vendor->vendor_name);
$pdf->SetTitle(JText::_('COM_VIRTUEMART_INVOICE_TITLE'));
$pdf->SetSubject(JText::sprintf('COM_VIRTUEMART_INVOICE_SUBJ', $view->vendor->vendor_store_name));
$pdf->SetKeywords('Invoice by VirtueMart 2');
//virtuemart.cloudaccess.net/index.php?option=com_virtuemart&view=invoice&layout=details&virtuemart_order_id=18&order_number=6e074d9b&order_pass=p_9cb9e2&task=checkStoreInvoice
if (empty($view->vendor->images[0])) {
vmError('Vendor image given path empty ');
} else {
if (empty($view->vendor->images[0]->file_url_folder) or empty($view->vendor->images[0]->file_name) or empty($view->vendor->images[0]->file_extension)) {
vmError('Vendor image given image is not complete ' . $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension);
vmdebug('Vendor image given image is not complete, the given media', $view->vendor->images[0]);
} else {
if (!empty($view->vendor->images[0]->file_extension) and strtolower($view->vendor->images[0]->file_extension) == 'png') {
vmError('Warning extension of the image is a png, tpcdf has problems with that in the header, choose a jpg or gif');
} else {
$imagePath = DS . str_replace('/', DS, $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension);
if (!file_exists(JPATH_ROOT . $imagePath)) {
vmError('Vendor image missing ' . $imagePath);
} else {
$pdf->SetHeaderData($imagePath, 60, $view->vendor->vendor_store_name, $view->vendorAddress);
}
}
}
}
// set header and footer fonts
$pdf->setHeaderFont(array('helvetica', '', 8));
$pdf->setFooterFont(array('helvetica', '', 10));
// 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);
//TODO include the right file (in libraries/tcpdf/config/lang set some language-dependent strings
$l = '';
$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('helvetica', '', 8, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// Set some content to print
// $html =
// Print text using writeHTMLCell()
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output($path, 'F');
return $path;
}
示例3: Header
$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('times', 'BI', 12);
// add a page
$pdf->AddPage();
$pdf->AddPage();
// set some text to print
$txt = <<<EOD
TCPDF Example 003
Custom page header and footer are defined by extending the TCPDF class and overriding the Header() and Footer() methods.
EOD;
// print a block of text using Write()
$pdf->Write($h = 0, $txt, $link = '', $fill = 0, $align = 'C', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
// ---------------------------------------------------------
示例4: getModel
function dispNstore_digitalCertificate()
{
$oNstore_digitalModel = getModel('nstore_digital');
$logged_info = Context::get('logged_info');
$cart_srl = Context::get('cart_srl');
if (!Context::get('is_logged')) {
return new Object(-1, 'msg_login_required');
}
$config = $oNstore_digitalModel->getModuleConfig();
$item_info = $oNstore_digitalModel->getPurchasedItem($logged_info->member_srl, $cart_srl);
Context::set('item_info', $item_info);
if (!in_array($item_info->order_status, array('3'))) {
return new Object(-1, '구매완료된 상품이 아닙니다.');
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 006');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
/*
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
*/
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
//$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// remove default header/footer
//$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
//$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
//$pdf->SetFont('dejavusans', '', 10);
$pdf->SetFont('cid0kr', '', 16);
// table line height
//$pdf->setCellHeightRatio(1.9);
$pdf->setCellHeightRatio(1.7);
// add a page
$pdf->AddPage();
// output the HTML content
$this->setTemplatePath($this->module_path . "tpl");
$oTemplate =& TemplateHandler::getInstance();
$output = $oTemplate->compile($this->module_path . 'tpl', 'certificate');
$pdf->writeHTML($output, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();
//Close and output PDF document
$pdf->Output('certificate.pdf', 'I');
exit;
}
示例5: ProcessRequest
function ProcessRequest()
{
// $pdf = $this->Pdf;
//============================================================+
// File name : example_003.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 003 for TCPDF class
// Custom Header and Footer
//
// 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: Custom Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
*/
// Include the main TCPDF library (search for installation path).
// require_once('tcpdf_include.php');
// 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 003');
$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, 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 (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', 'BI', 12);
// add a page
$pdf->AddPage();
// set some text to print
$txt = <<<EOD
TCPDF Example 003
Custom page header and footer are defined by extending the TCPDF class and overriding the Header() and Footer() methods.
EOD;
// print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'C', true, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_003.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
// $this->Save();
}
示例6: boookattach
function boookattach($results, $type = '')
{
// Include the main TCPDF library (search for installation path).
//require_once('tcpdf/examples/tcpdf_include.php');
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'utf-8', false);
//$pdf->Footer('hello');
// create new PDF document
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
//$pdf->SetAuthor('Nicola Asuni');
//$pdf->SetTitle('TCPDF Example 001');
//$pdf->SetSubject('<h1>TCPDF Tutorial</h1>');
//$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, '<div style="float:right">haoooooooo</div>', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(20);
//echo PDF_MARGIN_FOOTER;exit;
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
//$pdf->SetFont('dejavusans', '', 10, '', true);
$pdf->SetFont('Helvetica', '', 10, '', 'false');
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 1, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 0, 'blend_mode' => 'Normal'));
// Set some content to print
$tbl = '<br /><br/><br/><br/>
<table border="0" cellpadding="2" cellspacing="2" nobr="true">
<tr>
<td style="width:60%"><b>Your Personal Travel Advisor:</b>' . @$results['pdfdata']['adviser_info']['name'] . '</td>
<td style="width:40%"><b>Quote Reference:</b>' . @$results['pdfdata']['adviser_info']['reference'] . '</td>
</tr>
<tr>
<td style="width:60%"><b>Phone Number:</b>' . @$results['pdfdata']['adviser_info']['phone'] . '</td>
<td style="width:40%"><b>Date:</b> ' . @$results['pdfdata']['adviser_info']['date'] . '</td>
</tr>
<tr>
<td style="width:60%"><b>Email Address:</b>' . @$results['pdfdata']['adviser_info']['email'] . '</td>
<td style="width:40%"><b>Adults:</b> ' . @$results['seg'][0]['num_adults'] . ' <b>Children:</b> ' . @$results['seg'][0]['num_children'] . '</td>
</tr>
</table>';
$pdf->writeHTML($tbl, true, false, false, false, '');
//$ci = $results['controller'];
$t = json_decode($results['row'][0]['adults_info'], true);
$tbl = '
<div>
<span>Dear ' . $t['fname'][0] . '</span>
</br>
<p>
I have pleasure in enclosing a quote in respect of your recent enquiry with Super Escapes. Please feel free to contact us, should you need any more information or advice.
</p>
</div>';
$pdf->writeHTML($tbl, true, false, false, false, '');
if (isset($results['fobj'])) {
$depts = fetch_departures();
$arrivs = fetch_arrivals();
$dep_arr = explode('-', $depts[$results['fobj']['@attributes']['depapt']]);
$arr_arr = explode('-', $arrivs[$results['fobj']['@attributes']['arrapt']]);
$ret_arr = explode('-', $depts[$results['fobj']['@attributes']['retapt']]);
$dept_start_time = substr(explode(' ', $results['fobj']['@attributes']['outdep'])[1], 0, -3);
$dept_arr_time = substr(explode(' ', $results['fobj']['@attributes']['outarr'])[1], 0, -3);
$return_start_time = substr(explode(' ', $results['fobj']['@attributes']['indep'])[1], 0, -3);
$return_arr_time = substr(explode(' ', $results['fobj']['@attributes']['inarr'])[1], 0, -3);
$tbl = '
<b><u>Flight Details : </u></b><br><br>
<table border="0" cellpadding="2" cellspacing="2" nobr="true">
<tr>
<th style="width:35%;text-align:center;font-weight:bold;">Route</th>
<td style="width:13%;text-align:center;font-weight:bold;">Dep Date</td>
<td style="width:13%;text-align:center;font-weight:bold;">Dep Time</td>
<td style="width:13%;text-align:center;font-weight:bold;">Arr Date</td>
<td style="width:13%;text-align:center;font-weight:bold;">Arr Time</td>
<td style="width:13%;text-align:center;font-weight:bold;">Flight No</td>
//.........这里部分代码省略.........
示例7: creatNewPdf
function creatNewPdf()
{
$agru = func_get_arg(0);
$logo = $agru['logo'];
$link = $agru['link'];
$target = $agru['target'];
$logoExtention = $agru['logo_extention'];
$date = $agru['date'];
$title = $agru['title'];
$disc = $agru['description'];
$image = $agru['image'];
$content = $agru['content'];
$copyright = $agru['copyright'];
$fileName = $agru['file_name'];
$pdfCreator = $agru['pdf_creator'];
$pdfAuthor = $agru['pdf_author'];
$pdfTitle = $agru['pdf_title'];
$pdfSubject = $agru['pdf_subject'];
$pdfKeywords = $agru['pdf_keywords'];
// create new PDF document
$pdf = new MYPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setTempRTL('R');
$pdf->image_file = $logo;
$pdf->href = $target;
$pdf->link = $link;
$pdf->copyright = $copyright;
$this->extention = $logoExtention;
# must included in each decument[Must Include]
// appear in document properties
$pdf->SetCreator($pdfCreator);
$pdf->SetAuthor($pdfAuthor);
$pdf->SetTitle($pdfTitle);
$pdf->SetSubject($pdfSubject);
$pdf->SetKeywords($pdfKeywords);
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, ' ', ' ', array(0, 64, 255), array(0, 64, 128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
// 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));
// end of header
# set default monospaced font[Must Include]
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
# set margins[Must Include]
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// header & footer margin
$pdf->SetHeaderMargin(50);
$pdf->SetFooterMargin(20);
$pdf->SetAutoPageBreak(TRUE, 30);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setFontSubsetting(true);
//$pdf->SetFont('almohanad', '', 13);
$pdf->setRTL(true);
// cehck here if ar or en
$pdf->startPageGroup();
$pdf->AddPage();
$lg = array();
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = 'rtl';
$pdf->setLanguageArray($lg);
$pdf->SetFont('almohanad', '', 13);
$pdf->setRTL(true);
// cehck here if ar or en
$html = '
<div >
<br/>
<span id="date"style="color:#008080" > ' . $date . ' </span>
<h3 id="title" style="color:#191970"> ' . $title . ' </h3>
<h5 id="description" style="color:#6A5ACD"> ' . $disc . ' </h5>
<img src="' . $image . '" alt="' . $title . '" />
<div style="align:justify"> ' . $content . ' </div>
</div>
';
// $pdf->writeHTML($html, true, false, false, true, "");
$pdf->writeHTMLCell($w = 170, $h = 0, $x = 0, $y = 0, $html, $border = 0, $ln = 0, $fill = false, $reseth = true, $align = "R");
$pdf->setRTL(true);
#excute the file
$pdf->Output(PDF_FILES . $fileName . '.pdf', 'F');
}
示例8: printToServer
function printToServer($content, $name, $client, $folder_name, $version)
{
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setVersion($version);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Ignitor Labs');
$pdf->setHeaderFont(false);
$pdf->setPrintHeader(false);
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// add a page
$pdf->AddPage();
// set font
$pdf->SetFont('times', 'BI', 20, '', 'false');
//$pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0);
// create some HTML content
$html = $content;
// set core font
$pdf->SetFont('helvetica', '', 10);
// output the HTML content
$pdf->writeHTML($html, true, 0, true, true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('assets/contracts/' . $folder_name . '/' . $client . '_' . $name . '.pdf', 'F');
}
示例9:
$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('cn');
// set font
//$pdf->SetFont('droidsansfallback', '', 10);
$pdf->SetFont('cid0jp', '', 10);
// add a page
$pdf->AddPage();
$html = file_get_contents("http://localhost/bakup/index2.html");
$pdf->SetY(15);
// output the HTML content
// $pdf->writeHTML($html, true, false, true, false, '');
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
$pdf->SetCellPadding(0);
$pdf->lastPage();
$pdf->Output('test.pdf', 'I');
示例10: topdf
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');
}