示例#1
0
 $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 ' . $doc->getTCPDFVersion() . ' (http://www.tcpdf.org) <br />';
 $c .= 'Font of this test page: ' . $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', '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>';
     }
 }
 $c .= '<tr  style="font-size: x-small;"><td>Effective font path</td><td>' . $doc->_getfontpath() . '</td></tr>';
 $c .= '</table><br />';
 $c .= '<h3>Available font files</h3>';