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


PHP pdf::setHeaderData方法代码示例

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


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

示例1: pdf

 *
 * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
if ($getpdf) {
    $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 />';
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:pdflibtestpage.php

示例2: send

 public function send($filename)
 {
     $doc = new pdf($this->orientation);
     if ($this->title) {
         $doc->setHeaderData('', 0, $this->title);
         $doc->setPrintHeader(true);
     } else {
         $doc->setPrintHeader(false);
     }
     $doc->setPrintFooter(false);
     foreach ($this->pages as $page) {
         $doc->AddPage();
         if ($page->title) {
             $doc->writeHtml('<h2>' . $page->title . '</h2>');
         }
         // Find extent of the table.
         $rows = $this->get_row_count($page);
         $cols = $this->get_col_count($page);
         $relwidths = $this->compute_relative_widths($page);
         $o = html_writer::start_tag('table', array('border' => 1, 'cellpadding' => 1));
         for ($row = 0; $row < $rows; $row++) {
             $o .= html_writer::start_tag('tr');
             $col = 0;
             while ($col < $cols) {
                 $span = 1;
                 if (isset($page->mergers[$row][$col])) {
                     $mergewidth = (int) $page->mergers[$row][$col];
                     if ($mergewidth >= 1) {
                         $span = $mergewidth;
                     }
                 }
                 $opts = array();
                 if ($row == 0 && $relwidths[$col] > 0) {
                     $opts['width'] = $relwidths[$col] . '%';
                 }
                 if ($span > 1) {
                     $opts['colspan'] = $span;
                 }
                 $o .= html_writer::start_tag('td', $opts);
                 $cell = '';
                 if (isset($page->cells[$row][$col])) {
                     $cell = s($page->cells[$row][$col]);
                     if (isset($page->formats[$row][$col])) {
                         $thisformat = $page->formats[$row][$col];
                         if ($thisformat == 'header') {
                             $cell = html_writer::tag('b', $cell);
                         } else {
                             if ($thisformat == 'boldit') {
                                 $cell = html_writer::tag('i', $cell);
                             }
                         }
                     }
                 }
                 $o .= $cell;
                 $o .= html_writer::end_tag('td');
                 $col += $span;
             }
             $o .= html_writer::end_tag('tr');
         }
         $o .= html_Writer::end_tag('table');
         $doc->writeHtml($o);
     }
     $doc->Output($filename . '.pdf');
 }
开发者ID:ninelanterns,项目名称:moodle-mod_scheduler,代码行数:64,代码来源:exportlib.php


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