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


PHP pdf::writeHTML方法代码示例

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


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


//.........这里部分代码省略.........
     if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
         sendCacheHeaders();
         doHeader();
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array());
         echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array());
         doFooter();
         exit;
     }
     //Fin session time out
     $sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
     //I want to see the answers with this id
     //Ensure script is not run directly, avoid path disclosure
     //if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
     if ($aSurveyInfo['printanswers'] == 'N') {
         die;
         //Die quietly if print answers is not permitted
     }
     //CHECK IF SURVEY IS ACTIVATED AND EXISTS
     $sSurveyName = $aSurveyInfo['surveyls_title'];
     $sAnonymized = $aSurveyInfo['anonymized'];
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     //SHOW HEADER
     $sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
     if ($sExportType == 'pdf') {
         //require (Yii::app()->getConfig('rootdir').'/application/config/tcpdf.php');
         Yii::import('application.libraries.admin.pdf', true);
         Yii::import('application.helpers.pdfHelper');
         $aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($clang->langcode);
         $oPDF = new pdf();
         $oPDF->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
         $oPDF->SetSubject($sSurveyName);
         $oPDF->SetDisplayMode('fullpage', 'two');
         $oPDF->setLanguageArray($aPdfLanguageSettings['lg']);
         $oPDF->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
         $oPDF->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
         $oPDF->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
         $oPDF->AddPage();
         $oPDF->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
     }
     $sOutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p>&nbsp;\n";
     LimeExpressionManager::StartProcessingPage(true);
     // means that all variables are on the same page
     // Since all data are loaded, and don't need JavaScript, pretend all from Group 1
     LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
     $printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
     $aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
     //Get the fieldmap @TODO: do we need to filter out some fields?
     if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
         unset($aFullResponseTable['submitdate']);
     } else {
         unset($aFullResponseTable['id']);
     }
     unset($aFullResponseTable['token']);
     unset($aFullResponseTable['lastpage']);
     unset($aFullResponseTable['startlanguage']);
     unset($aFullResponseTable['datestamp']);
     unset($aFullResponseTable['startdate']);
     $sOutput .= "<table class='printouttable' >\n";
     foreach ($aFullResponseTable as $sFieldname => $fname) {
         if (substr($sFieldname, 0, 4) == 'gid_') {
             $sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
         } elseif (substr($sFieldname, 0, 4) == 'qid_') {
             $sOutput .= "\t<tr class='printanswersquestionhead'><td colspan='2'>{$fname[0]}</td></tr>\n";
         } elseif ($sFieldname == 'submitdate') {
             if ($sAnonymized != 'Y') {
                 $sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]} {$sFieldname}</td><td class='printanswersanswertext'>{$fname[2]}</td></tr>";
             }
         } else {
             $sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>" . flattenText($fname[2]) . "</td></tr>";
         }
     }
     $sOutput .= "</table>\n";
     $sData['thissurvey'] = $aSurveyInfo;
     $sOutput = templatereplace($sOutput, array(), $sData, '', $aSurveyInfo['anonymized'] == "Y", NULL, array(), true);
     // Do a static replacement
     if ($sExportType == 'pdf') {
         $oPDF->writeHTML($sOutput);
         header("Pragma: public");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         $sExportFileName = sanitize_filename($sSurveyName);
         $oPDF->Output($sExportFileName . "-" . $iSurveyID . ".pdf", "D");
     } else {
         ob_start(function ($buffer, $phase) {
             App()->getClientScript()->render($buffer);
             App()->getClientScript()->reset();
             return $buffer;
         });
         ob_implicit_flush(false);
         sendCacheHeaders();
         doHeader();
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array(), $sData);
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/printanswers.pstpl'), array('ANSWERTABLE' => $sOutput), $sData);
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array(), $sData);
         echo "</body></html>";
         ob_flush();
     }
     LimeExpressionManager::FinishProcessingGroup();
     LimeExpressionManager::FinishProcessingPage();
 }
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:101,代码来源:PrintanswersController.php

示例3: printToPdf

 function printToPdf($htmlContent)
 {
     $pdf = new pdf();
     $pdf->print_header = false;
     $pdf->print_footer = false;
     $pdf->AddPage();
     $pdf->writeHTML($htmlcontent, true, 0, true, 0);
     $pdf->output('document.pdf', 'I');
 }
开发者ID:laiello,项目名称:poodll.poodll23,代码行数:9,代码来源:assignment.class.php

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

示例5: array

            $langconfig = $CFG->dataroot . '/lang/' . $langdir . '/langconfig.php';
        }
        // Ignore parents here for now.
        $string = array();
        if (is_readable($langconfig)) {
            include $langconfig;
            if (is_array($string)) {
                $languages[$langdir] = new stdClass();
                $languages[$langdir]->langname = isset($string['thislanguage']) ? $string['thislanguage'] : '(unknown)';
                $languages[$langdir]->alphabet = isset($string['alphabet']) ? '"' . $string['alphabet'] . '"' : '(no alphabet defined)';
            }
        }
    }
    $c .= '<dl>';
    foreach ($languages as $langcode => $language) {
        $c .= '<dt>' . $language->langname . ' (' . $langcode . ')</dt>';
        $c .= '<dd>' . $language->alphabet . '</dd>';
    }
    $c .= '</dl>';
    $doc->writeHTML($c);
    $doc->Output('pdflibtestpage.pdf');
    exit;
}
$PAGE->set_url('/lib/tests/other/pdflibtestpage.php');
$PAGE->set_context($context);
$PAGE->set_title('PDF library test');
$PAGE->set_heading('PDF library test');
echo $OUTPUT->header();
echo $OUTPUT->heading('Press the button to generate test PDF', 2);
echo $OUTPUT->continue_button(new moodle_url($PAGE->url, array('getpdf' => 1, 'fontfamily' => PDF_FONT_NAME_MAIN)));
echo $OUTPUT->footer();
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:pdflibtestpage.php

示例6:

	elseif($stu_status == 99){
		$status = "-";
	}
	else{
		$status = "-";
	}
	
	$tbl1="<table width=100% >
			<tr>
			<td align='left'><span><h4><b>".strtoupper(get_string('semester', 'local_semesters'))." : </span>". $sname ."</b></h4></td>
			<td ><span><h4><b>".get_string('gp', 'local_request')." : </span>". $sem_gpa ."</b></h4></td>
			<td align='right'><span><h4><b>".strtoupper(get_string('status', 'local_request'))." : </span>". $status ."</b></h4></td>
			</tr>
			</table>";
	if ($sem_gpa != None)
	$doc->writeHTML($tbl1, true, false, false, false, '');
	$i = 0;
	foreach ($clclasses as $cls) {
		$cocourseid = $DB->get_field('local_clclasses','cobaltcourseid',array('id'=>$cls->classid));
		$cur_pro_sql = "SELECT * FROM {local_curriculum_plancourses} planco 
						JOIN {local_userdata} udat on udat.curriculumid=planco.curriculumid 
						where planco.curriculumid={$curid} and planco.courseid={$cocourseid} and udat.userid={$semuserid}";
		$course_exist_incur = $DB->get_records_sql($cur_pro_sql);
		if($course_exist_incur) {
			$coursename = get_cobalt_course_grad($cls->classid);
			if ($i % 2 == 0)
			$tbl .= '<tr bgcolor="#ffffff">';
			else
			$tbl .= '<tr bgcolor="#F5F5F5">';
			$tbl .= '<td style="width:150px;">'.$coursename.'</td>';
			$maxmarks=$DB->get_field('local_scheduledexams','sum(grademax) AS grademax',array('classid'=>$cls->classid));
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:memo_pdf.php


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