当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF::setCellHeightRatio方法代码示例

本文整理汇总了PHP中TCPDF::setCellHeightRatio方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::setCellHeightRatio方法的具体用法?PHP TCPDF::setCellHeightRatio怎么用?PHP TCPDF::setCellHeightRatio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDF的用法示例。


在下文中一共展示了TCPDF::setCellHeightRatio方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderPDF


//.........这里部分代码省略.........
     if (!defined('K_TCPDF_CALLS_IN_HTML')) {
         define('K_TCPDF_CALLS_IN_HTML', true);
     }
     switch ($option) {
         case 'com_content':
             $content = new JObject();
             // Get info from Phoca PDF Content Plugin
             $dispatcher =& JDispatcher::getInstance();
             JPluginHelper::importPlugin('system');
             $results = $dispatcher->trigger('onBeforeCreatePDFContent', array(&$content));
             if (JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocapdf' . DS . 'helpers' . DS . 'phocapdfcontenttcpdf.php')) {
                 require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocapdf' . DS . 'helpers' . DS . 'phocapdfcontenttcpdf.php';
                 $pdf = new PhocaPDFContentTCPDF($content->page_orientation, 'mm', $content->page_format, true, 'UTF-8', $content->use_cache);
             } else {
                 return JError::raiseError('PDF ERROR', 'Document cannot be created - Loading of Phoca PDF library (Content) failed');
             }
             break;
         case 'com_phocamenu':
             // Get info from Phoca PDF Restaurant Menu Plugin
             $content = new JObject();
             $dispatcher =& JDispatcher::getInstance();
             JPluginHelper::importPlugin('phocapdf');
             $results = $dispatcher->trigger('onBeforeCreatePDFRestaurantMenu', array(&$content));
             if (JFile::exists(JPATH_SITE . DS . 'plugins' . DS . 'phocapdf' . DS . 'restaurantmenu.php')) {
                 require_once JPATH_SITE . DS . 'plugins' . DS . 'phocapdf' . DS . 'restaurantmenu.php';
                 $pdf = new PhocaPDFRestaurantMenuTCPDF($content->page_orientation, 'mm', $content->page_format, true, 'UTF-8', $content->use_cache);
             } else {
                 return JError::raiseError('PDF ERROR', 'Document cannot be created - Loading of Phoca PDF Plugin (Restaurant Menu) failed');
             }
             break;
         case 'com_virtuemart':
             // Get info from Phoca PDF VirtueMart Plugin
             $content = new JObject();
             $dispatcher =& JDispatcher::getInstance();
             JPluginHelper::importPlugin('phocapdf');
             $results = $dispatcher->trigger('onBeforeCreatePDFVirtueMart', array(&$content, $staticData));
             if (JFile::exists(JPATH_SITE . DS . 'plugins' . DS . 'phocapdf' . DS . 'virtuemart.php')) {
                 require_once JPATH_SITE . DS . 'plugins' . DS . 'phocapdf' . DS . 'virtuemart.php';
                 $pdf = new PhocaPDFVirtueMartTCPDF($content->page_orientation, 'mm', $content->page_format, true, 'UTF-8', $content->use_cache);
                 $pdf->setStaticData($staticData);
             } else {
                 return JError::raiseError('PDF ERROR', 'Document cannot be created - Loading of Phoca PDF Plugin (VirtueMart) failed');
             }
             break;
         default:
             require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocapdf' . DS . 'helpers' . DS . 'phocapdf.php';
             require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocapdf' . DS . 'assets' . DS . 'tcpdf' . DS . 'tcpdf.php';
             $content = new JObject();
             // Get info from Phoca PDF Content Plugin
             $dispatcher =& JDispatcher::getInstance();
             JPluginHelper::importPlugin('system');
             $results = $dispatcher->trigger('onBeforeCreatePDF' . $t, array(&$content));
             $pdf = new TCPDF($content->page_orientation, 'mm', $content->page_format, true, 'UTF-8', $content->use_cache);
             break;
             break;
     }
     //krumo("exit");exit;
     $pdf->SetMargins($content->margin_left, $content->margin_top, $content->margin_right);
     $pdf->SetAutoPageBreak(TRUE, $content->margin_bottom);
     $pdf->setCellHeightRatio($content->site_cell_height);
     $pdf->setFont($content->font_type);
     $siteFontColor = $pdf->convertHTMLColorToDec($content->site_font_color);
     $pdf->SetTextColor($siteFontColor['R'], $siteFontColor['G'], $siteFontColor['B']);
     //$pdf->setPageFormat($content->page_format, $content->page_orientation);
     $pdf->SetHeaderMargin($content->header_margin);
     $pdf->SetFooterMargin($content->footer_margin);
     $pdf->setImageScale($content->image_scale);
     // PDF Metadata
     $pdf->SetCreator(PDF_CREATOR);
     // Content
     switch ($option) {
         default:
             $results = $dispatcher->trigger('onBeforeDisplayPDF' . $t, array(&$pdf, &$content, &$this));
             break;
         case 'com_content':
             $results = $dispatcher->trigger('onBeforeDisplayPDFContent', array(&$pdf, &$content, &$document));
             break;
         case 'com_phocamenu':
             $results = $dispatcher->trigger('onBeforeDisplayPDFRestaurantMenu', array(&$pdf, &$content, &$document));
             break;
         case 'com_virtuemart':
             $results = $dispatcher->trigger('onBeforeDisplayPDFVirtueMart', array(&$pdf, &$content, &$document, $staticData));
             break;
     }
     if (isset($staticData['file']) && $staticData['file'] != '') {
         $pdf->Output($staticData['file'], 'F');
         return true;
     }
     // Called from administrator area (administrator calls frontend view, but it still administrator area)
     $adminView = JRequest::getVar('admin', 0, '', 'int');
     if ($adminView == 1) {
         $content->pdf_destination = 'S';
     }
     if ($content->pdf_destination == 'D' || $content->pdf_destination == 'I') {
         $pdf->Output($content->pdf_name, $content->pdf_destination);
         return true;
     }
     $data = $pdf->Output($content->pdf_name, $content->pdf_destination);
     return $data;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:101,代码来源:phocapdfrender.php

示例2: dirname

if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
    require_once dirname(__FILE__) . '/lang/eng.php';
    $pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.7);
// set color for cell border
$pdf->SetDrawColor(0, 128, 255);
$pdf->setCellHeightRatio(3);
$pdf->SetXY(15, 60);
// text on center
$pdf->Cell(30, 0, 'Top-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'C');
$pdf->Cell(30, 0, 'Center-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'C');
$pdf->Cell(30, 0, 'Bottom-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'C');
$pdf->Cell(30, 0, 'Ascent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'C');
$pdf->Cell(30, 0, 'Baseline-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'C');
$pdf->Cell(30, 0, 'Descent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'C');
$pdf->SetXY(15, 90);
// text on top
$pdf->Cell(30, 0, 'Top-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'T');
$pdf->Cell(30, 0, 'Center-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'T');
$pdf->Cell(30, 0, 'Bottom-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'T');
$pdf->Cell(30, 0, 'Ascent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'T');
$pdf->Cell(30, 0, 'Baseline-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'T');
开发者ID:hcvcastro,项目名称:pxp,代码行数:31,代码来源:example_057.php

示例3: renderHead

 $pdf->SetTitle($json->today);
 $pdf->SetSubject($json->today);
 $pdf->SetKeywords($json->today);
 // 设置页眉和页脚信息
 $pdf->SetHeaderData('', 0, '今日|' . $json->today, 'today.exformation.com.cn');
 $pdf->setFooterData('today.exformation.com.cn');
 // 设置页眉和页脚字体
 $pdf->setHeaderFont(array('droidsansfallback', '', '10'));
 $pdf->setFooterFont(array('helvetica', '', '8'));
 // 设置默认等宽字体
 $pdf->SetDefaultMonospacedFont('courier');
 // 设置间距
 $pdf->SetMargins(15, 21, 15);
 $pdf->SetHeaderMargin(5);
 $pdf->SetFooterMargin(10);
 $pdf->setCellHeightRatio(0.7);
 // 设置分页
 $pdf->SetAutoPageBreak(TRUE, 25);
 // set image scale factor
 $pdf->setImageScale(1.25);
 // set default font subsetting mode
 $pdf->setFontSubsetting(true);
 //设置字体
 $pdf->SetFont('droidsansfallback', '', 12);
 $pdf->AddPage();
 $content = renderHead($json);
 $content .= '<br/>';
 foreach ($json->tasks as $item) {
     $content = $content . render($item->title, $item->completedAt, $item->duration, $item->memo);
 }
 $pdf->writeHTML($content);
开发者ID:Bing573,项目名称:today-gtd,代码行数:31,代码来源:pdf.php

示例4: btnPrint_Click

 protected function btnPrint_Click()
 {
     if ($this->lstLabelStock->SelectedValue) {
         $this->lstLabelStock->Warning = "";
         set_time_limit(0);
         // If the user clicked Cancel button
         if ($_SESSION["intGeneratingStatus"] != -1) {
             // If the user clicked outside of the modal dialog
             if ($this->dlgPrintLabels->Visible && $this->dlgPrintLabels->Display) {
                 if ($this->intCurrentBarCodeLabel < count($this->strBarCodeArray)) {
                     array_push($this->strTablesBufferArray, $this->CreateTableByBarCodeArray());
                     $this->txtWarning->Text = "Please wait... PDF Generating: " . $_SESSION["intGeneratingStatus"] . "% Complete";
                     $this->txtWarning->Display = true;
                     $this->btnPrint->Enabled = true;
                     QApplication::ExecuteJavaScript("document.getElementById('" . $this->btnPrint->ControlId . "').click();");
                 } else {
                     include_once '../includes/php/tcpdf/config/lang/eng.php';
                     include_once '../includes/php/tcpdf/tcpdf.php';
                     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
                     // Set document information
                     $pdf->SetCreator("Tracmor");
                     $pdf->SetAuthor("Tracmor");
                     $pdf->SetTitle("Bar Codes");
                     // Set PDF viewer preferences
                     $arrPreferences = array('PrintScaling' => 'None');
                     $pdf->setViewerPreferences($arrPreferences);
                     // Disable header and footer
                     $pdf->setPrintHeader(false);
                     $pdf->setPrintFooter(false);
                     // Disable auto page breaks
                     $pdf->SetAutoPageBreak(false);
                     // Set some language-dependent strings
                     $pdf->setLanguageArray($l);
                     // Set the color used for all drawing operations (lines, rectangles and cell borders).
                     $pdf->SetDrawColor(255);
                     // white
                     // Set Cell Padding
                     $pdf->SetCellPadding(0);
                     // Set Cell Spacing
                     $pdf->SetLineWidth(0);
                     // Initialize document
                     $pdf->AliasNbPages();
                     switch ($this->lstLabelStock->SelectedValue) {
                         case 1:
                             // Labels per row for Avery 6577 (5/8" x 3")
                             $pdf->SetFontSize(3);
                             $pdf->setCellHeightRatio(2.3);
                             // was 1.93
                             // Set margins
                             $pdf->SetMargins(12, 12, 12);
                             break;
                         case 2:
                             // Labels per row for Avery 6576 (1-1/4" x 1-3/4")
                             $pdf->SetFontSize(3);
                             $pdf->setCellHeightRatio(11.0);
                             // was 10.2
                             // Set margins
                             $pdf->SetMargins(10, 16, 10);
                             break;
                         default:
                             throw new QCallerException('Label Stock Not Provided');
                             break;
                     }
                     foreach ($this->strTablesBufferArray as $strTableBuffer) {
                         // add a page
                         $pdf->AddPage();
                         // output the HTML content
                         $pdf->writeHTML($strTableBuffer);
                     }
                     // Close and save PDF document
                     $pdf->Output(".." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf", "F");
                     // Cleaning up
                     $this->btnCancel_Click();
                     // Uncheck all items but SelectAll checkbox
                     foreach ($this->GetAllControls() as $objControl) {
                         if (substr($objControl->ControlId, 0, 11) == 'chkSelected') {
                             $objControl->Checked = false;
                         }
                     }
                     $arrDataGridObjectNameId = $this->ctlSearchMenu->GetDataGridObjectNameId();
                     // Uncheck SelectAll checkbox
                     $this->ctlSearchMenu->{$arrDataGridObjectNameId}[0]->chkSelectAll->Checked = false;
                     // Open generated PDF in new window
                     QApplication::ExecuteJavaScript("window.open('.." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf','Barcodes','resizeable,menubar=1,scrollbar=1,left=0,top=0,width=800,height=600');");
                 }
             } else {
                 // Cleaning up
                 $this->btnCancel_Click();
             }
         }
     } else {
         $this->lstLabelStock->Warning = "Please select one";
         $this->lstLabelStock->Enabled = true;
     }
 }
开发者ID:jdellinger,项目名称:tracmor,代码行数:95,代码来源:labels.php

示例5: actionGenCodeCard

 public function actionGenCodeCard($request_type)
 {
     // Validate settings
     if (!Yii::app()->user->checkAccess("UserAdmin")) {
         $this->redirect(array('view', 'id' => $model->id));
     }
     $code_card = Yii::app()->getModule('user')->codeCard;
     if (empty($code_card['host']) || empty($code_card['apy_key']) || empty($code_card['crypt_key'])) {
         $this->redirect(array('view', 'id' => $model->id));
     }
     $model = $this->loadModel();
     $profile = $model->profile;
     $error = '';
     if ($request_type == 'validate_code') {
         if (empty($_POST['code']) || empty($_POST['session_id'])) {
             $this->redirect(array('view', 'id' => $model->id));
         }
         $add_data = $_POST['code'];
         $session_id = $_POST['session_id'];
     } else {
         $add_data = $model->id;
         $session_id = '';
     }
     $request = array('request_type' => $request_type, 'user_id' => Yii::app()->user->getId(), 'add_data' => $add_data, 'session_id' => $session_id);
     $reply = array('error' => '');
     CodeCard::request($request, $reply);
     if ($reply['error']) {
         $error = UserModule::t($reply['error']);
     } elseif ($reply['reply_type'] == 'code_card') {
         // Savec codeCard expire date
         $profile->setAttribute('code_card_expire_date', $reply['add_data']['expire_date']);
         $profile->save();
         // Save codeCard as PDF
         $pdf = new TCPDF('L', PDF_UNIT, 'BUSINESS_CARD_ES', true, 'UTF-8', false);
         //Basic setup
         $pdf->setPrintHeader(false);
         $pdf->setPrintFooter(false);
         // set default monospaced font
         $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
         // set margins
         $pdf->SetMargins(0, 2, 4, true);
         $pdf->SetHeaderMargin(0);
         $pdf->SetFooterMargin(0);
         // set font
         $pdf->SetFont('helvetica', '', 8);
         $pdf->setCellHeightRatio(1.1);
         // add a page
         $pdf->AddPage();
         $html = $this->renderPartial('codeCard', array('reply' => $reply), true);
         //echo $html;
         //exit;
         // output the HTML content
         $pdf->writeHTML($html, false);
         // reset pointer to the last page
         $pdf->lastPage();
         $pdf->Output('CodeCard.pdf', 'D');
         exit;
     }
     if ($reply['reply_type'] == 'validate_code') {
         $view = 'validate_code';
     } else {
         $view = 'codeCard_empty';
     }
     if (Yii::app()->getModule('user')->view) {
         $alt_view = Yii::app()->getModule('user')->view . '.admin.' . $view;
         if (is_readable(Yii::getPathOfAlias($alt_view) . '.php')) {
             $view = $alt_view;
             $this->layout = Yii::app()->getModule('user')->layout;
         }
     }
     $this->render($view, array('model' => $model, 'reply' => $reply, 'error' => $error));
 }
开发者ID:uldisn,项目名称:yii-user,代码行数:72,代码来源:AdminController.php

示例6: Cell

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.7);
// set color for cell border
$pdf->SetDrawColor(0, 128, 255);
$pdf->setCellHeightRatio(3);
$pdf->SetXY(15, 60);
// text on center
$pdf->Cell(30, 0, 'Top-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'C');
$pdf->Cell(30, 0, 'Center-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'C');
$pdf->Cell(30, 0, 'Bottom-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'C');
$pdf->Cell(30, 0, 'Ascent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'C');
$pdf->Cell(30, 0, 'Baseline-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'C');
$pdf->Cell(30, 0, 'Descent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'C');
$pdf->SetXY(15, 90);
// text on top
$pdf->Cell(30, 0, 'Top-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'T');
$pdf->Cell(30, 0, 'Center-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'T');
$pdf->Cell(30, 0, 'Bottom-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'T');
$pdf->Cell(30, 0, 'Ascent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'T');
$pdf->Cell(30, 0, 'Baseline-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'T');
开发者ID:cristminix,项目名称:cGRhbXRrcg-,代码行数:31,代码来源:example_057.php

示例7: display


//.........这里部分代码省略.........
					$params->set('marker_mobile', $image6);
					$params->set('marker_class', 'jicons-icons');
					break;
			}
		}

		$params->set('prepare_content', '0');

		// Setup the category parameters.
		$cparams          = $category->getParams();
		$category->params = clone $params;
		$category->params->merge($cparams);
		$children = [$category->id => $children];
		$maxLevel = $params->get('maxLevel', -1);
		$items    = $renderHelper->groupit(['items' => & $items, 'field' => 'lname']);

		if (0)
		{
			foreach ($items as $s1)
			{
				$items[$s1] = $renderHelper->groupit(['items' => $items[$s1], 'field' => 'suburb']);
			}
		}

		$this->renderHelper = $renderHelper;
		$this->maxLevel     = & $maxLevel;
		$this->state        = & $state;
		$this->items        = $items;
		$this->category     = & $category;
		$this->children     = & $children;
		$this->params       = & $params;
		$this->pagination   = & $pagination;

		// Escape strings for HTML output
		$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));

		$menus = $app->getMenu();
		$title = 'directory_prent_out';

		// Because the application sets a default page title,
		// we need to get it from the menu item itself
		$menu = $menus->getActive();

		// Clean the output buffer
		@ob_end_clean();

		// Create new PDF document
		$this->pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

		// Set document information
		$this->pdf->SetCreator(PDF_CREATOR);
		$this->pdf->SetAuthor('NFSDA Church');
		$this->pdf->SetTitle($this->params->get('page_title', ''));
		$this->pdf->SetSubject('Church Directory');
		$this->pdf->SetKeywords('Directory, PDF, Members');

		// Set default header data
		$this->pdf->setHeaderData(
			$params->get('pdf_logo'),
			$params->get('pdf_logo_width'),
			$this->params->get('page_heading'),
			$params->get('pdf_header_string')
		);

		// Remove default header/footer
		$this->pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
		$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);

		$this->pdf->setCellHeightRatio(1.25);

		// Set image scale factor
		$this->pdf->setImageScale(2.5);

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

		// Set font
		$this->pdf->SetFont('times', 'BI', 8, '', 'false');

		// Set some text to print
		$html = $this->loadTemplate($tpl);

		$jweb  = new JApplicationWeb;
		$jweb->clearHeaders();

		// Close and output PDF document
		$this->pdf->Output($title . '.pdf', 'I');

		return null;
	}
开发者ID:Joomla-Bible-Study,项目名称:joomla_churchdirectory,代码行数:101,代码来源:view.pdf.php

示例8: 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 057');
        $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 . ' 057', 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 font
        $pdf->SetFont('helvetica', 'B', 20);
        // add a page
        $pdf->AddPage();
        $pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
        $pdf->SetFont('helvetica', '', 11);
        // set border width
        $pdf->SetLineWidth(0.7);
        // set color for cell border
        $pdf->SetDrawColor(0, 128, 255);
        $pdf->setCellHeightRatio(3);
        $pdf->SetXY(15, 60);
        // text on center
        $pdf->Cell(30, 0, 'Top-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'C');
        $pdf->Cell(30, 0, 'Center-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'C');
        $pdf->Cell(30, 0, 'Bottom-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'C');
        $pdf->Cell(30, 0, 'Ascent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'C');
        $pdf->Cell(30, 0, 'Baseline-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'C');
        $pdf->Cell(30, 0, 'Descent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'C');
        $pdf->SetXY(15, 90);
        // text on top
        $pdf->Cell(30, 0, 'Top-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'T');
        $pdf->Cell(30, 0, 'Center-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'T');
        $pdf->Cell(30, 0, 'Bottom-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'T');
        $pdf->Cell(30, 0, 'Ascent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'T');
        $pdf->Cell(30, 0, 'Baseline-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'T');
        $pdf->Cell(30, 0, 'Descent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'T');
        $pdf->SetXY(15, 120);
        // text on bottom
        $pdf->Cell(30, 0, 'Top-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'B');
        $pdf->Cell(30, 0, 'Center-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'B');
        $pdf->Cell(30, 0, 'Bottom-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'B');
        $pdf->Cell(30, 0, 'Ascent-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'B');
        $pdf->Cell(30, 0, 'Baseline-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'B');
        $pdf->Cell(30, 0, 'Descent-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'B');
        // draw some reference lines
        $linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(255, 0, 0));
        $pdf->Line(15, 60, 195, 60, $linestyle);
        $pdf->Line(15, 90, 195, 90, $linestyle);
        $pdf->Line(15, 120, 195, 120, $linestyle);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // Print an image to explain cell measures
        $pdf->Image('tests/images/tcpdf_cell.png', 15, 160, 100, 100, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
        $legend = 'LEGEND:

X: cell x top-left origin (top-right for RTL)
Y: cell y top-left origin (top-right for RTL)
CW: cell width
CH: cell height
LW: line width
NRL: normal line position
EXT: external line position
INT: internal line position
ML: margin left
MR: margin right
MT: margin top
MB: margin bottom
PL: padding left
PR: padding right
PT: padding top
PB: padding bottom
TW: text width
FA: font ascent
FB: font baseline
FD: font descent';
        $pdf->SetFont('helvetica', '', 10);
        $pdf->setCellHeightRatio(1.25);
        $pdf->MultiCell(0, 0, $legend, 0, 'L', false, 1, 125, 160, true, 0, false, true, 0, 'T', false);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // CELL BORDERS
        // add a page
        $pdf->AddPage();
//.........这里部分代码省略.........
开发者ID:fooman,项目名称:tcpdf,代码行数:101,代码来源:Example057Test.php

示例9: drawTextBox

 /**
  * @param string $content
  * @param float|string $x
  * @param float|string $y
  * @param float|string $width
  * @param float|string $height
  * @param array $attrs {
  *      @option string "font_family" required
  *      @option string[] "font_style" required
  *      @option float|string "font_size" required
  *      @option string "color" required
  *      @option string "overflow" optional default is "trunecate"
  *      @option boolean "single_row" optional default is false
  *      @option string "align" optional default is "left"
  *      @option string "valign" optional default is "top"
  *      @option string "letter_spacing" optional default is 0
  *      @option string "line_height" optional default is {@see self::$pdf_default_line_height}
  * }
  * @see http://www.tcpdf.org/doc/code/classTCPDF.html
  */
 public function drawTextBox($content, $x, $y, $width, $height, array $attrs = array())
 {
     $styles = $this->buildTextBoxStyles($height, $attrs);
     $this->setFontStyles($styles);
     $this->pdf->setFontSpacing($styles['letter_spacing']);
     $this->pdf->setCellHeightRatio($styles['line_height']);
     $overflow = $styles['overflow'];
     $font_family = $attrs['font_family'];
     $font_styles = $attrs['font_style'];
     $color = $styles['color'];
     $emulating = $this->startStyleEmulation($font_family, $font_styles, $color);
     $this->pdf->MultiCell($width, $height, $content, 0, $styles['align'], false, 1, $x, $y, true, 0, false, true, $overflow['max_height'], $styles['valign'], $overflow['fit_cell']);
     if ($emulating) {
         $this->resetStyleEmulation();
     }
 }
开发者ID:monnouchi,项目名称:thinreports-php,代码行数:36,代码来源:Text.php


注:本文中的TCPDF::setCellHeightRatio方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。