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


PHP pdf::SetTextColor方法代码示例

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


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

示例1: render_content

 /**
  * Common behaviour for rendering specified content on the pdf.
  *
  * @param pdf $pdf the pdf object
  * @param string $content the content to render
  */
 public function render_content($pdf, $content)
 {
     list($font, $attr) = $this->get_font();
     $pdf->setFont($font, $attr, $this->element->size);
     $fontcolour = TCPDF_COLORS::convertHTMLColorToDec($this->element->colour, $fontcolour);
     $pdf->SetTextColor($fontcolour['R'], $fontcolour['G'], $fontcolour['B']);
     $x = $this->element->posx;
     $y = $this->element->posy;
     $w = $this->element->width;
     $align = $this->element->align;
     $refpoint = $this->element->refpoint;
     $actualwidth = $pdf->GetStringWidth($content);
     if ($w and $w < $actualwidth) {
         $actualwidth = $w;
     }
     switch ($refpoint) {
         case CUSTOMCERT_REF_POINT_TOPRIGHT:
             $x = $this->element->posx - $actualwidth;
             if ($x < 0) {
                 $x = 0;
                 $w = $this->element->posx;
             } else {
                 $w = $actualwidth;
             }
             break;
         case CUSTOMCERT_REF_POINT_TOPCENTER:
             $x = $this->element->posx - $actualwidth / 2;
             if ($x < 0) {
                 $x = 0;
                 $w = $this->element->posx * 2;
             } else {
                 $w = $actualwidth;
             }
             break;
     }
     if ($w) {
         $w += 0.0001;
     }
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->writeHTMLCell($w, 0, $x, $y, $content, 0, 0, false, true, $align);
 }
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:47,代码来源:element.class.php

示例2: pdf

 $doc = new pdf();
 $doc->SetTitle('Moodle PDF library test');
 $doc->SetAuthor('Moodle ' . $CFG->release);
 $doc->SetCreator('lib/tests/other/pdflibtestpage.php');
 $doc->SetKeywords('Moodle, PDF');
 $doc->SetSubject('This has been generated by Moodle as its PDF library test page');
 $doc->SetMargins(15, 30);
 $doc->setPrintHeader(true);
 $doc->setHeaderMargin(10);
 $doc->setHeaderFont(array($fontfamily, 'b', 10));
 $doc->setHeaderData('pix/moodlelogo-med-white.gif', 40, $SITE->fullname, $CFG->wwwroot);
 $doc->setPrintFooter(true);
 $doc->setFooterMargin(10);
 $doc->setFooterFont(array($fontfamily, '', 8));
 $doc->AddPage();
 $doc->SetTextColor(255, 255, 255);
 $doc->SetFillColor(255, 203, 68);
 $doc->SetFont($fontfamily, 'B', 24);
 $doc->Cell(0, 0, 'Moodle PDF library test', 0, 1, 'C', 1);
 $doc->SetFont($fontfamily, '', 12);
 $doc->Ln(6);
 $doc->SetTextColor(0, 0, 0);
 $c = '<h3>General information</h3>';
 $c .= 'Moodle release: ' . $CFG->release . '<br />';
 $c .= 'PDF producer: TCPDF ' . TCPDF_STATIC::getTCPDFVersion() . ' (http://www.tcpdf.org) <br />';
 $c .= 'Font family used: ' . $fontfamily . '<br />';
 $c .= '<h3>Current settings</h3>';
 $c .= '<table border="1"  cellspacing="0" cellpadding="1">';
 foreach (array('K_PATH_MAIN', 'K_PATH_URL', 'K_PATH_FONTS', 'PDF_FONT_NAME_MAIN', 'K_PATH_CACHE', 'K_PATH_IMAGES', 'K_BLANK_IMAGE', 'K_CELL_HEIGHT_RATIO', 'K_SMALL_RATIO', 'PDF_CUSTOM_FONT_PATH', 'PDF_DEFAULT_FONT') as $setting) {
     if (defined($setting)) {
         $c .= '<tr style="font-size: x-small;"><td>' . $setting . '</td><td>' . constant($setting) . '</td></tr>';
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:pdflibtestpage.php


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