本文整理汇总了PHP中TCPDF::setFontSubsetting方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::setFontSubsetting方法的具体用法?PHP TCPDF::setFontSubsetting怎么用?PHP TCPDF::setFontSubsetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::setFontSubsetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPdfOutput
public function testPdfOutput()
{
// 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('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 . ' 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)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// 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', '', 14, '', true);
// 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
<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$this->comparePdfs($pdf);
}
示例2: pdfthongkeAction
public function pdfthongkeAction()
{
$translate = Zend_Registry::get('Zend_Translate');
$this->view->title = 'Thống kê - ' . $translate->_('TEXT_DEFAULT_TITLE');
$this->view->headTitle($this->view->title);
$layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
$option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
Zend_Layout::startMvc($option);
$date = new Zend_Date();
$date->subMonth(1);
$thang = $this->_getParam('thang', $date->toString('M'));
$nam = $this->_getParam('nam', $date->toString('Y'));
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$em_id = $identity->em_id;
$emModel = new Front_Model_Employees();
$phongbanModel = new Front_Model_Phongban();
$my_info = $emModel->fetchRow('em_id=' . $em_id . ' and em_status=1');
$phong_ban_id = $list_phongban = $phong_ban = array();
if ($my_info) {
$phong_ban_id[] = $my_info->em_phong_ban;
$list_phongban = $phongbanModel->fetchDataStatus($my_info->em_phong_ban, $phong_ban);
}
if (sizeof($list_phongban)) {
foreach ($list_phongban as $phong_ban_info) {
$phong_ban_id[] = $phong_ban_info->pb_parent;
}
}
$phong_ban_id = implode(',', $phong_ban_id);
$list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
$holidaysModel = new Front_Model_Holidays();
$holidays = $holidaysModel->fetchData();
$listHoliday = array();
foreach ($holidays as $holiday) {
$listHoliday[$holiday['hld_id']] = $holiday['hld_code'];
}
$k = 0;
if ($list_nhan_vien) {
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetTitle(PDF_HEADER_TITLE);
$pdf->SetSubject(PDF_HEADER_TITLE);
$pdf->SetKeywords('bang luong');
$pdf->setPrintHeader(false);
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(5, PDF_MARGIN_TOP, 5);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setFontSubsetting(true);
$pdf->SetFont('dejavusans', '', 14, '', true);
$pdf->AddPage('L', 'A4');
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
$text_outout = '
<style>
.ten-co-quan {
color: #000;
font-size: 10pt;
height: 50px;
text-align:center;
}
.ten-bang-luong{
height: 30px;
text-align:center;
font-size: 10pt;
}
table.first {
color: #003300;
font-family: helvetica;
font-size: 8pt;
border-left: 3px solid red;
border-right: 3px solid #FF00FF;
border-top: 3px solid green;
border-bottom: 3px solid blue;
background-color: #ccffcc;
}
.borders {
border: 1px solid #000;
font-size: 10px;
}
.tieu-de{
height: 20px;
font-size: 11px;
}
.noi-dung{
font-size: 10px;
}
td.second {
border: 2px dashed green;
}
.lowercase {
text-transform: lowercase;
}
//.........这里部分代码省略.........
示例3: display
function display($tpl = null)
{
global $mainframe;
$app = JFactory::getApplication();
$params = $app->getParams();
$this->assignRef('params', $params);
$user = JFactory::getUser();
$username = $user->username;
$this->child = JFactory::getUser($username);
$layout = $params->get('layout');
$this->tasks = JoomdleHelperContent::call_method("get_children_grade_user_report", $username);
$tpl = "catspdf";
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->_prepareDocument();
$htmlcontent = parent::loadTemplate($tpl);
require_once JPATH_SITE . '/libraries/tcpdf/tcpdf.php';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$header = JText::_('COM_JOOMDLE_GRADES');
$pdf->SetHeaderData('', 0, $header);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFontSubsetting(false);
$pdf->SetFont('times', '', 8);
// add a page
$pdf->AddPage("L");
// output the HTML content
$pdf->writeHTML($htmlcontent, true, 0, true, 0);
$pdf->Output("grades.pdf", 'D');
exit;
}
示例4: create_pdf
function create_pdf($content, $title)
{
tcpdf();
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$title = $title;
$obj_pdf->SetTitle('MultiTV analytics');
$obj_pdf->SetAuthor('MultiTv');
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();
//ob_start();
// we can have any view part here like HTML, PHP etc
//$content = ob_get_contents();
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
$obj_pdf->Output('output.pdf', 'I');
}
示例5: __construct
public function __construct($s_title, $sPageFormat = 'A4', $sPageOrientation = 'L')
{
parent::__construct($s_title);
define(K_PATH_FONTS, APPROOT . 'lib/tcpdf/fonts');
$this->oPdf = new iTopPDF($sPageOrientation, 'mm', $sPageFormat, true, 'UTF-8', false);
// set document information
$this->oPdf->SetCreator(PDF_CREATOR);
$this->oPdf->SetAuthor('iTop');
$this->oPdf->SetTitle($s_title);
$this->oPdf->SetDocumentTitle($s_title);
$this->oPdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font. Standard PDF fonts like helvetica or times new roman are NOT UTF-8
$this->oPdf->SetFont('dejavusans', '', 10, '', true);
// set auto page breaks
$this->oPdf->SetAutoPageBreak(true, 15);
// 15 mm break margin at the bottom
$this->oPdf->SetTopMargin(15);
// Add a page, we're ready to start
$this->oPdf->AddPage();
$this->SetContentDisposition('inline', $s_title . '.pdf');
$this->SetDefaultStyle();
}
示例6: save
/**
* Save PHPExcel to file
*
* @param string $pFilename Name of the file to save as
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null)
{
$fileHandle = parent::prepareForSave($pFilename);
// Default PDF paper size
$paperSize = 'LETTER';
// Letter (8.5 in. by 11 in.)
// Check for paper size and page orientation
if (is_null($this->getSheetIndex())) {
$orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
} else {
$orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
}
// Override Page Orientation
if (!is_null($this->getOrientation())) {
$orientation = $this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
}
// Override Paper Size
if (!is_null($this->getPaperSize())) {
$printPaperSize = $this->getPaperSize();
}
if (isset(self::$paperSizes[$printPaperSize])) {
$paperSize = self::$paperSizes[$printPaperSize];
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf->setFontSubsetting(false);
// Set margins, converting inches to points (using 72 dpi)
$pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
$pdf->SetAutoPageBreak(true, $printMargins->getBottom() * 72);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage();
// Set the appropriate font
$pdf->SetFont($this->getFont());
$pdf->writeHTML($this->generateHTMLHeader(false) . $this->generateSheetData() . $this->generateHTMLFooter());
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
// Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
parent::restoreStateAfterSave($fileHandle);
}
示例7: testPdfOutput
public function testPdfOutput()
{
$this->markTestIncomplete('Repository excludes pdfahelvetica font.');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 065');
$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 . ' 065', 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)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// 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();
// Set some content to print
$html = <<<EOD
<h1>Example of <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a> document in <span style="background-color:#99ccff;color:black;"> PDF/A-1b </span> mode.</h1>
<i>This document conforms to the standard <b>PDF/A-1b (ISO 19005-1:2005)</b>.</i>
<p>Please check the source code documentation and other examples for further information (<a href="http://www.tcpdf.org">http://www.tcpdf.org</a>).</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
$this->comparePdfs($pdf);
}
示例8: create_pdf
function create_pdf($campdata)
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator('Dreamcity');
$pdf->SetAuthor('Dreamcity');
$pdf->SetTitle('TCPDF Example 001');
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_RIGHT);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// 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', '', 14, '', 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 = "<h1>Dear Dreamer</h1>\r\n<i>Here is a Copy of your previous application</i>\r\n<p></p>" . "<br/>" . $campdata->camp_description . "<br/>" . $campdata->camp_short_desc . "<br/>" . $campdata->camp_construction . "<br/>" . $campdata->camp_participants . "<br/>" . $campdata->camp_registration_date;
// 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.
//$data = $pdf->Output('application.pdf', 'E');
$data = $pdf->Output('application.pdf', 'S');
//$data = array($fileatt);
//$data = chunk_split($fileatt);
/*
//$fileatt = "./test.pdf";
$fileatttype = "application/pdf";
$fileattname = "newname.pdf";
$file = fopen($fileatt, 'rb');
$data = fread($file, filesize($fileatt));
fclose($file);
*/
return $data;
}
示例9: testPdfOutput
public function testPdfOutput()
{
// 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 033');
$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 . ' 033', 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)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// add a page
$pdf->AddPage();
// set default font subsetting mode
$pdf->setFontSubsetting(false);
$pdf->SetFont('helvetica', 'B', 20);
$pdf->Write(0, 'Font Types', '', 0, 'C', 1, 0, false, false, 0);
$pdf->Ln(10);
$pdf->SetFont('times', '', 10);
$pdf->MultiCell(80, 0, "[Core font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
$pdf->Ln(2);
$pdf->SetFont('dejavusans', '', 10);
$pdf->MultiCell(80, 0, "[True Type Unicode font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
$pdf->Ln(2);
$pdf->SetFont('cid0jp', '', 9);
$pdf->MultiCell(80, 0, "[CID-0 font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
$this->comparePdfs($pdf);
}
示例10: generatePdf
/**
* @param string $content
* @param string $destination
* @return string
*/
public function generatePdf($content, $destination)
{
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetTitle($this->getFileName());
$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->setFontSubsetting(true);
$pdf->SetFont('helvetica', '', 9, '', true);
$pdf->AddPage();
$pdf->writeHTMLCell(0, 0, '', '', $content, 0, 1, 0, true, '', true);
$pdf->Output($destination, 'F');
return $destination;
}
示例11: pdfInit
/**
* Init PDF exportu
*
* @param string $title nadpis stránky
* @param char $orientation P|L
*/
public function pdfInit($title = null, $orientation = 'P')
{
$this->filename .= $title;
// pdf object
$this->pdf = new TCPDF($orientation);
// set document information
$this->pdf->SetCreator(PDF_CREATOR);
$this->pdf->SetAuthor(EaseShared::user()->getUsername());
$this->pdf->SetTitle($title);
$this->pdf->SetSubject('');
$this->pdf->SetKeywords($title);
// set default header data
$this->pdf->SetHeaderData('logo.png', 45, $title, "DB Finance s.r.o - nezávislý investiční zprostředkovatel a pojišťovací makléř\n" . "✉ dbfinance@dbfinance.cz ☎ 222 541 990 – 995 ⌨ www.dbfinance.cz ");
// set header and footer fonts
$this->pdf->setHeaderFont(array('dejavusans', '', 8));
$this->pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$this->pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$this->pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$this->pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$this->pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// ---------------------------------------------------------
// set default font subsetting mode
$this->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.
$this->pdf->SetFont('dejavusans', '', 8, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$this->pdf->AddPage();
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
}
示例12: generatePDF
/**
* Generate the pdf document
* @param IsotopeProductCollection
* @param array
* @return \TCPDF
*/
protected function generatePDF(IsotopeProductCollection $objCollection, array $arrTokens)
{
// TCPDF configuration
$l = array();
$l['a_meta_dir'] = 'ltr';
$l['a_meta_charset'] = $GLOBALS['TL_CONFIG']['characterSet'];
$l['a_meta_language'] = substr($GLOBALS['TL_LANGUAGE'], 0, 2);
$l['w_page'] = 'page';
// Include TCPDF config
require_once TL_ROOT . '/system/config/tcpdf.php';
if (version_compare(VERSION, '3.3', '<')) {
require_once TL_ROOT . '/system/modules/core/vendor/tcpdf/tcpdf.php';
}
// Create new PDF document
$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
// Set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetTitle(\String::parseSimpleTokens($this->documentTitle, $arrTokens));
// Prevent font subsetting (huge speed improvement)
$pdf->setFontSubsetting(false);
// Remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// Set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// 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);
// Initialize document and add a page
$pdf->AddPage();
// Set font
$pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);
// Write the HTML content
$pdf->writeHTML($this->generateTemplate($objCollection, $arrTokens), true, 0, true, 0);
$pdf->lastPage();
return $pdf;
}
示例13: getAttatchment
public function getAttatchment()
{
$title = $this->input->get('title');
$attatch = $this->input->get('attatchment');
$this->form_validation->set_rules('reportTitle', 'Report Title', 'required');
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
tcpdf();
// create new PDF document
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
//set title of report
$obj_pdf->SetAuthor($this->session->userdata['username']);
$obj_pdf->SetTitle($title);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();
$obj_pdf->Image($attatch, 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
$path = 'C:/xampp/htdocs/QADash/public_html/reports';
// Supply a filename including the .pdf extension
$filename = $this->{$title};
// Create the full path
$full_path = $path . '/' . $filename;
// Output PDF
$obj_pdf->Output($full_path, 'F');
//save report details in database
$details = $this->saveReport($this->session->userdata['uid'], $filename, $path . '/' . $filename);
$this->report_m->saveReport($details);
//redirect to view the generated pdf file
$this->data['report'] = $filename;
$this->data['subview'] = 'manager/user/report/singleReport_view';
$this->load->view("manager/_layout_main", $this->data);
}
示例14: print_pdf
function print_pdf($pdf_filename, $pdf_body)
{
// Include the main TCPDF library (search for installation path).
require_once ABSPATH . 'lib/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('Περιφέρεια Δυτικής Μακεδονίας');
$pdf->SetTitle('Περιφέρεια Δυτικής Μακεδονίας');
$pdf->SetSubject('Περιφέρεια Δυτικής Μακεδονίας');
$pdf->SetKeywords('Περιφέρεια Δυτικής Μακεδονίας');
// 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 default font subsetting mode
$pdf->setFontSubsetting(true);
// set font
$pdf->SetFont('freeserif', '', 11);
// add a page el
$pdf->AddPage();
$pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0);
$pdf->writeHTML($pdf_body, true, false, false, false, '');
//Close and output PDF document
$pdf->Output($pdf_filename, 'F');
}
示例15: create_voucher_file
function create_voucher_file($p, $q, $c, $b = "Mytour Voucher", $r = "Mytour.vn", $t = "Mytour.vn", $u = "mytour, mytour.vn, voucher")
{
global $v;
$z = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$z->SetCreator(PDF_CREATOR);
$z->SetAuthor($r);
$z->SetTitle($b);
$z->SetSubject($t);
$z->SetKeywords($u);
$z->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$z->SetMargins(5, 10, 5);
$z->SetHeaderMargin(-10);
$z->SetFooterMargin(10);
$z->SetAutoPageBreak(TRUE, 10);
$z->setImageScale(PDF_IMAGE_SCALE_RATIO);
$z->setLanguageArray($v);
$z->setFontSubsetting(true);
$z->addFont('DejaVuSerif', '', 'dejavuserif.php');
$z->SetFont('DejaVuSerif', '', 9, '', 'true');
$z->AddPage();
$z->writeHTMLCell($aa = 0, $bb = 0, $cc = '', $dd = '', $c, $ee = 0, $ff = 1, $gg = 0, $hh = true, $ii = '', $jj = true);
$z->Output($p . $q . '.pdf', 'F');
}