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


PHP pdf::setPrintFooter方法代码示例

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


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

示例1: pdf

 function report_download_pdf($html)
 {
     $doc = new pdf();
     //$doc->Header();
     $doc->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, 'Teleparadigm', array(), array());
     $doc->setFooterData(array(0, 64, 0), array(0, 64, 128));
     $doc->setPrintHeader(false);
     $doc->setPrintFooter(true);
     // set margins
     $doc->SetMargins(PDF_MARGIN_LEFT, 5, PDF_MARGIN_RIGHT);
     $doc->SetHeaderMargin(PDF_MARGIN_HEADER);
     $doc->SetFooterMargin(PDF_MARGIN_FOOTER);
     $doc->AddPage();
     $doc->writeHTML($html, true, false, true, false, '');
     $doc->Output();
     die;
 }
开发者ID:kmahesh541,项目名称:mitclone,代码行数:17,代码来源:export_reports.php

示例2: create_pdf_object

 /**
  * Create PDF object using parameters
  * 
  * @return PDF
  */
 protected function create_pdf_object()
 {
     //Default orientation is Landescape
     $orientation = 'L';
     if ($this->get_instance()->height > $this->get_instance()->width) {
         $orientation = 'P';
     }
     // Remove commas to avoid a bug in TCPDF where a string containing a commas will result in two strings.
     $keywords = get_string('keywords', 'simplecertificate') . ',' . format_string($this->get_instance()->coursename, true);
     $keywords = str_replace(",", " ", $keywords);
     // Replace commas with spaces.
     $keywords = str_replace("  ", " ", $keywords);
     // Replace two spaces with one.
     $pdf = new pdf($orientation, 'mm', array($this->get_instance()->width, $this->get_instance()->height), true, 'UTF-8');
     $pdf->SetTitle($this->get_instance()->name);
     $pdf->SetSubject($this->get_instance()->name . ' - ' . $this->get_instance()->coursename);
     $pdf->SetKeywords($keywords);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetAutoPageBreak(false, 0);
     $pdf->setFontSubsetting(true);
     $pdf->SetMargins(0, 0, 0, true);
     return $pdf;
 }
开发者ID:seducto,项目名称:moodle-mod_simplecertificate,代码行数:29,代码来源:locallib.php

示例3: elang_pluginfile

/**
 * Serves the files from the elang file areas
 *
 * @param   stdClass  $course         the course object
 * @param   stdClass  $cm             the course module object
 * @param   stdClass  $context        the elang's context
 * @param   string    $filearea       the name of the file area
 * @param   array     $args           extra arguments (itemid, path)
 * @param   boolean   $forcedownload  whether or not force download
 * @param   array     $options        additional options affecting the file serving
 *
 * @return  void
 *
 * @category  files
 *
 * @since   0.0.1
 */
function elang_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload, array $options = array())
{
    global $DB, $CFG, $USER;
    require_once dirname(__FILE__) . '/locallib.php';
    if ($context->contextlevel != CONTEXT_MODULE) {
        send_file_not_found();
    }
    require_login($course, true, $cm);
    if (!has_capability('mod/elang:view', $context)) {
        send_file_not_found();
    }
    if ($filearea == 'subtitle') {
        $vtt = new \Captioning\Format\WebvttFile();
        $idlang = $cm->instance;
        $records = $DB->get_records('elang_cues', array('id_elang' => $idlang), 'begin ASC');
        $elang = $DB->get_record('elang', array('id' => $idlang));
        $options = json_decode($elang->options, true);
        $repeatedunderscore = isset($options['repeatedunderscore']) ? $options['repeatedunderscore'] : 10;
        $i = 0;
        $users = $DB->get_records('elang_users', array('id_elang' => $idlang, 'id_user' => $USER->id), '', 'id_cue,json');
        foreach ($records as $id => $record) {
            if (isset($users[$id])) {
                $data = json_decode($users[$id]->json, true);
            } else {
                $data = array();
            }
            $cue = new \Captioning\Format\WebvttCue(\Captioning\Format\WebvttCue::ms2tc($record->begin), \Captioning\Format\WebvttCue::ms2tc($record->end), Elang\generateCueText(json_decode($record->json, true), $data, '-', $repeatedunderscore));
            $i++;
            $cue->setIdentifier($i);
            $vtt->addCue($cue);
        }
        send_file($vtt->build()->getFileContent(), end($args), 0, 0, true, false, 'text/vtt');
    } elseif ($filearea == 'pdf') {
        $idlang = $cm->instance;
        $records = $DB->get_records('elang_cues', array('id_elang' => $idlang), 'begin ASC');
        $elang = $DB->get_record('elang', array('id' => $idlang));
        $options = json_decode($elang->options, true);
        $repeatedunderscore = isset($options['repeatedunderscore']) ? $options['repeatedunderscore'] : 10;
        require_once $CFG->libdir . '/pdflib.php';
        $doc = new pdf();
        $doc->SetMargins(isset($options['left']) ? $options['left'] : 20, isset($options['top']) ? $options['top'] : 20);
        $doc->SetFont('', '', isset($options['size']) ? $options['size'] : 16);
        $doc->setPrintHeader(false);
        $doc->setPrintFooter(false);
        $doc->AddPage();
        $doc->WriteHtml('<h1>' . sprintf(get_string('pdftitle', 'elang'), $course->fullname) . '</h1>');
        $doc->WriteHtml('<h2>' . sprintf(get_string('pdfsubtitle', 'elang'), Elang\generateTitle($elang, $options), userdate($elang->timecreated, get_string('strftimedaydate'))) . '</h2>');
        $doc->WriteHtml($elang->intro);
        $i = 1;
        foreach ($records as $id => $record) {
            $doc->Write(5, '', '', false, '', true);
            $doc->WriteHtml('<h3>' . sprintf(get_string('pdfcue', 'elang'), $i++, \Captioning\Format\WebvttCue::ms2tc($record->begin), \Captioning\Format\WebvttCue::ms2tc($record->end)) . '</h3>');
            $doc->Write(5, Elang\generateCueText(json_decode($record->json, true), array(), '_', $repeatedunderscore), '', false, '', true);
        }
        send_file($doc->Output('', 'S'), end($args), 0, 0, true, false, 'application/pdf');
    } else {
        $fs = get_file_storage();
        $relativepath = implode('/', $args);
        $fullpath = rtrim('/' . $context->id . '/mod_elang/' . $filearea . '/0/' . $relativepath, '/');
        $file = $fs->get_file_by_hash(sha1($fullpath));
        if (!$file) {
            send_file_not_found();
        }
        send_stored_file($file, 86400, 0, $forcedownload, $options);
    }
}
开发者ID:e-lang,项目名称:moodle-mod_elang,代码行数:83,代码来源:lib.php

示例4: 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

示例5: array

    function export_pdf($report, $fname = '') {
        global $DB, $CFG;
        require_once($CFG->libdir . '/pdflib.php');

        $table = $report->table;
        $matrix = array();
        $fname == '' ? $filename = 'report' : $filename = $fname . '.pdf';

        if (!empty($table->head)) {
            $countcols = count($table->head);
            $keys = array_keys($table->head);
            $lastkey = end($keys);
            foreach ($table->head as $key => $heading) {
                $matrix[0][$key] = str_replace("\n", ' ', htmlspecialchars_decode(strip_tags(nl2br($heading))));
            }
        }

        if (!empty($table->data)) {
            foreach ($table->data as $rkey => $row) {
                foreach ($row as $key => $item) {
                    $matrix[$rkey + 1][$key] = str_replace("\n", ' ', htmlspecialchars_decode(strip_tags(nl2br($item))));
                }
            }
        }
        $table = "";

        $table .="<table border=\"1\" cellpadding=\"5\"><thead><tr>";
        $s = count($matrix);
        reset($matrix);
        $first_key = key($matrix);
        for ($i = $first_key; $i < ($first_key + 1); $i++) {
            foreach ($matrix[$i] as $col) {
                $table .="<td><b>$col</b></td>";
            }
        }
        $table .="</tr></thead><tbody>";
        for ($i = ($first_key + 1); $i < count($matrix); $i++) {
            $table .="<tr>";
            foreach ($matrix[$i] as $col) {
                $table .="<td>$col</td>";
            }
            $table .="</tr>";
        }
        $table .="</tbody></table>";
        $table .="";
        $doc = new pdf;
        $doc->setPrintHeader(false);
        $doc->setPrintFooter(false);
        $doc->AddPage();

        $doc->writeHTML($table);

        if ($fname == '') {
            $doc->Output();
            exit;
        } else {
            $doc->Output($filename, 'F');
        }
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:59,代码来源:lib.php

示例6: 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 />';
    $c .= '<h3>Current settings</h3>';
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:pdflibtestpage.php

示例7: customcert_generate_pdf

/**
 * Generate the PDF for the specified customcert and user.
 *
 * @param stdClass $customcert
 * @param bool $preview true if it is a preview, false otherwise
 */
function customcert_generate_pdf($customcert, $preview = false)
{
    global $CFG, $DB;
    require_once $CFG->libdir . '/pdflib.php';
    // Get the pages for the customcert, there should always be at least one page for each customcert.
    if ($pages = $DB->get_records('customcert_pages', array('customcertid' => $customcert->id), 'pagenumber ASC')) {
        // Create the pdf object.
        $pdf = new pdf();
        if (!empty($customcert->protection)) {
            $protection = explode(', ', $customcert->protection);
            $pdf->SetProtection($protection);
        }
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->SetTitle($customcert->name);
        $pdf->SetAutoPageBreak(true, 0);
        // Remove full-stop at the end, if it exists, to avoid "..pdf" being created and being filtered by clean_filename.
        $filename = rtrim($customcert->name, '.');
        $filename = clean_filename($filename . '.pdf');
        // Loop through the pages and display their content.
        foreach ($pages as $page) {
            // Add the page to the PDF.
            if ($page->width > $page->height) {
                $orientation = 'L';
            } else {
                $orientation = 'P';
            }
            $pdf->AddPage($orientation, array($page->width, $page->height));
            $pdf->SetMargins(0, 0, $page->margin);
            // Get the elements for the page.
            if ($elements = $DB->get_records('customcert_elements', array('pageid' => $page->id), 'sequence ASC')) {
                // Loop through and display.
                foreach ($elements as $element) {
                    // Get an instance of the element class.
                    if ($e = customcert_get_element_instance($element)) {
                        $e->render($pdf, $preview);
                    }
                }
            }
        }
        $pdf->Output($filename, 'D');
    }
}
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:49,代码来源:locallib.php

示例8: certificate_output_entity_completion

/**
 * Refactored code from @see certificate_output_completion()
 * an array of parameters is passed and used by the certificate
 * template file.  It is up to the certificate template file to
 * use whatever parameters are available
 *
 * @param array $params: An array of parameters (example: array('student_name' => 'some value'))
 * Here are a list of values that can be used
 * 'student_name', 'course_name', 'class_idnumber', 'class_enrol_time', 'class_enddate', 'class_grade',
 * 'cert_timeissued', 'cert_code', 'class_instructor_name', 'course_description_name'
 * (there will most likely be more when other entity types are added)
 * @param string $border:               A custom border image to use
 * @param string $seal:                 A custom seal image to use
 * @param string $template:             A custom template to use
 * @return string - pdf output
 */
function certificate_output_entity_completion($params, $border = '', $seal = '', $template = '')
{
    global $CFG;
    // Use the TCPDF library.
    require_once $CFG->libdir . '/pdflib.php';
    // Global settings.
    $borders = 0;
    $font = 'FreeSerif';
    $largefontsize = 30;
    $smallfontsize = 16;
    // Create pdf.
    $pdf = new pdf('L', 'in', 'Letter');
    // Prevent the pdf from printing black bars.
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->SetAutoPageBreak(false);
    $pdf->SetMargins(0, 0, 0, false);
    $pdf->AddPage();
    $pagewidth = $pdf->getPageWidth();
    $pageheight = $pdf->getPageHeight();
    // Draw the border.
    cm_certificate_check_data_path('borders');
    if (!empty($border)) {
        if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/borders/' . $border)) {
            $pdf->Image($CFG->dirroot . '/local/elisprogram/pix/certificate/borders/' . $border, 0, 0, $pagewidth, $pageheight);
        } else {
            if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/borders/' . $border)) {
                $pdf->Image($CFG->dataroot . '/local/elisprogram/pix/certificate/borders/' . $border, 0, 0, $pagewidth, $pageheight);
            }
        }
    }
    // Draw the seal.
    cm_certificate_check_data_path('seals');
    if (!empty($seal)) {
        if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/seals/' . $seal)) {
            $pdf->Image($CFG->dirroot . '/local/elisprogram/pix/certificate/seals/' . $seal, 8.0, 5.8);
        } else {
            if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/seals/' . $seal)) {
                $pdf->Image($CFG->dataroot . '/local/elisprogram/pix/certificate/seals/' . $seal, 8.0, 5.8);
            }
        }
    }
    // Include the certificate template.
    cm_certificate_check_data_path('templates');
    if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/templates/' . $template)) {
        include $CFG->dirroot . '/local/elisprogram/pix/certificate/templates/' . $template;
    } else {
        if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/templates/' . $template)) {
            include $CFG->dataroot . '/local/elisprogram/pix/certificate/templates/' . $template;
        }
    }
    $pdf->Output();
}
开发者ID:jamesmcq,项目名称:elis,代码行数:69,代码来源:certificate.php

示例9: array

 */
// function print_grades() {
global $CFG,$DB;
require_once ('../../config.php');
require_once($CFG->dirroot.'/local/graduation/lib.php');
require_once($CFG->dirroot.'/local/lib.php'); 
$curid = optional_param ('curid', 0, PARAM_INT);
$userid = optional_param ('userid', 0, PARAM_INT);
$prgid = optional_param ('prgid', 0, PARAM_INT);
$year = optional_param ('year', 0, PARAM_INT);
ob_clean() ;
require_once($CFG->dirroot.'/lib/pdflib.php');

$doc = new pdf;
$doc->setPrintHeader(false);
$doc->setPrintFooter(false);
$doc->AddPage();
$doc->SetFont('times', 'B', 25, '', 'false');
$gradst = $DB->get_record('local_graduation', array('userid'=>$userid, 'curriculumid'=>$curid, 'programid'=>$prgid));
$txt = $DB->get_field('local_school', 'fullname', array('id'=>$gradst->schoolid));
$doc->Write(0, $txt, '', 0, 'C', true, 0, false, false, 20);
$linestyle = array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2', 'phase' => 0, 'color' => array(0, 0, 0));
$doc->Line(10, 22, 200, 22, $linestyle);
$doc->SetFont('times', 'BI', 14, '', 'false');
$txt = get_string('memo', 'local_graduation');
$doc->Write(12, $txt, '', 0, 'C', true, 0, false, false, 20);
$linestyle = array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2', 'phase' => 0, 'color' => array(0, 0, 0));
$doc->Line(80, 30, 130, 30, $linestyle);
$doc->SetFont('times', '', 12, '', 'false');
$gradst = $DB->get_record('local_graduation', array('userid'=>$userid, 'curriculumid'=>$curid, 'programid'=>$prgid));
$gradst->userid;$gradst->programid;$gradst->curriculumid;
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:memo_pdf.php


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