本文整理汇总了PHP中mPDF::setBasePath方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::setBasePath方法的具体用法?PHP mPDF::setBasePath怎么用?PHP mPDF::setBasePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::setBasePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
//.........这里部分代码省略.........
$sNorthPane = '<div id="bottom-pane" class="ui-layout-north">' . $sNorthPane . '</div>';
}
if (!empty($sSouthPane)) {
$sSouthPane = '<div id="bottom-pane" class="ui-layout-south">' . $sSouthPane . '</div>';
}
$sIconUrl = Utils::GetConfig()->Get('app_icon_url');
$sOnlineHelpUrl = MetaModel::GetConfig()->Get('online_help');
//$sLogOffMenu = "<span id=\"logOffBtn\" style=\"height:55px;padding:0;margin:0;\"><img src=\"../images/onOffBtn.png\"></span>";
$sDisplayIcon = utils::GetAbsoluteUrlAppRoot() . 'images/itop-logo.png';
if (file_exists(MODULESROOT . 'branding/main-logo.png')) {
$sDisplayIcon = utils::GetAbsoluteUrlModulesRoot() . 'branding/main-logo.png';
}
$sHtml .= $sNorthPane;
$sHtml .= '<div id="left-pane" class="ui-layout-west">';
$sHtml .= '<!-- Beginning of the left pane -->';
$sHtml .= ' <div class="ui-layout-north">';
$sHtml .= ' <div id="header-logo">';
$sHtml .= ' <div id="top-left"></div><div id="logo"><a href="' . htmlentities($sIconUrl, ENT_QUOTES, 'UTF-8') . '"><img src="' . $sDisplayIcon . '" title="' . htmlentities($sVersionString, ENT_QUOTES, 'UTF-8') . '" style="border:0; margin-top:16px; margin-right:40px;"/></a></div>';
$sHtml .= ' </div>';
$sHtml .= ' <div class="header-menu">';
if (!MetaModel::GetConfig()->Get('demo_mode')) {
$sHtml .= ' <div class="icon ui-state-default ui-corner-all"><span id="tPinMenu" class="ui-icon ui-icon-pin-w">pin</span></div>';
}
$sHtml .= ' <div style="text-align:center;">' . self::FilterXSS($sForm) . '</div>';
$sHtml .= ' </div>';
$sHtml .= ' </div>';
$sHtml .= ' <div id="menu" class="ui-layout-center">';
$sHtml .= ' <div id="inner_menu">';
$sHtml .= ' <div id="accordion">';
$sHtml .= self::FilterXSS($this->m_sMenu);
$sHtml .= ' <!-- Beginning of the accordion menu -->';
$sHtml .= ' <!-- End of the accordion menu-->';
$sHtml .= ' </div>';
$sHtml .= ' </div> <!-- /inner menu -->';
$sHtml .= ' </div> <!-- /menu -->';
$sHtml .= ' <div class="footer ui-layout-south"><div id="combodo_logo"><a href="http://www.combodo.com" title="www.combodo.com" target="_blank"><img src="../images/logo-combodo.png"/></a></div></div>';
$sHtml .= '<!-- End of the left pane -->';
$sHtml .= '</div>';
$sHtml .= '<div class="ui-layout-center">';
$sHtml .= ' <div id="top-bar" style="width:100%">';
$sHtml .= self::FilterXSS($sApplicationBanner);
$sHtml .= ' <div id="global-search"><form action="' . utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php"><table><tr><td></td><td id="g-search-input"><input type="text" name="text" value="' . $sText . '"' . $sOnClick . '/></td>';
$sHtml .= '<td><input type="image" src="../images/searchBtn.png"/></a></td>';
$sHtml .= '<td><a style="background:transparent;" href="' . $sOnlineHelpUrl . '" target="_blank"><img style="border:0;padding-left:20px;padding-right:10px;" title="' . Dict::S('UI:Help') . '" src="../images/help.png"/></td>';
$sHtml .= '<td style="padding-right:20px;padding-left:10px;">' . self::FilterXSS($sLogOffMenu) . '</td><td><input type="hidden" name="operation" value="full_text"/></td></tr></table></form></div>';
//echo '<td> <input type="hidden" name="operation" value="full_text"/></td></tr></table></form></div>';
$sHtml .= ' </div>';
$sHtml .= ' <div class="ui-layout-content" style="overflow:auto;">';
$sHtml .= ' <!-- Beginning of page content -->';
$sHtml .= self::FilterXSS($this->s_content);
$sHtml .= ' <!-- End of page content -->';
$sHtml .= ' </div>';
$sHtml .= '</div>';
$sHtml .= $sSouthPane;
// Add the captured output
if (trim($s_captured_output) != "") {
$sHtml .= "<div id=\"rawOutput\" title=\"Debug Output\"><div style=\"height:500px; overflow-y:auto;\">" . self::FilterXSS($s_captured_output) . "</div></div>\n";
}
$sHtml .= "<div id=\"at_the_end\">" . self::FilterXSS($this->s_deferred_content) . "</div>";
$sHtml .= "<div style=\"display:none\" title=\"ex2\" id=\"ex2\">Please wait...</div>\n";
// jqModal Window
$sHtml .= "<div style=\"display:none\" title=\"dialog\" id=\"ModalDlg\"></div>";
$sHtml .= "<div style=\"display:none\" id=\"ajax_content\"></div>";
} else {
$sHtml .= self::FilterXSS($this->s_content);
}
$sHtml .= "</body>\n";
$sHtml .= "</html>\n";
if ($this->GetOutputFormat() == 'html') {
$oKPI = new ExecutionKPI();
echo $sHtml;
$oKPI->ComputeAndReport('Echoing (' . round(strlen($sHtml) / 1024) . ' Kb)');
} else {
if ($this->GetOutputFormat() == 'pdf' && $this->IsOutputFormatAvailable('pdf')) {
if (@is_readable(APPROOT . 'lib/MPDF/mpdf.php')) {
require_once APPROOT . 'lib/MPDF/mpdf.php';
$oMPDF = new mPDF('c');
$oMPDF->mirroMargins = false;
if ($this->a_base['href'] != '') {
$oMPDF->setBasePath($this->a_base['href']);
// Seems that the <BASE> tag is not recognized by mPDF...
}
$oMPDF->showWatermarkText = true;
if ($this->GetOutputOption('pdf', 'template_path')) {
$oMPDF->setImportUse();
// Allow templates
$oMPDF->SetDocTemplate($this->GetOutputOption('pdf', 'template_path'), 1);
}
$oMPDF->WriteHTML($sHtml);
$sOutputName = $this->s_title . '.pdf';
if ($this->GetOutputOption('pdf', 'output_name')) {
$sOutputName = $this->GetOutputOption('pdf', 'output_name');
}
$oMPDF->Output($sOutputName, 'I');
}
}
}
DBSearch::RecordQueryTrace();
ExecutionKPI::ReportStats();
}
示例2: mpdf
/**
* @param $url string - address of the item to print as PDF
* @return string - contents of the PDF
*/
private function mpdf($url)
{
if (!extension_loaded('curl')) {
TikiLib::lib('reporterror')->report(tra('mPDF: CURL PHP extension not available'));
return '';
}
// To prevent anyone else using your script to create their PDF files - TODO?
//if (!preg_match("/^$base_url/", $url)) { die("Access denied"); }
/* FIXME later, cookie auth not working yet
$cookie = [];
foreach ($_COOKIE as $key => $value) {
$cookie[] = "{$key}={$value}";
};
$cookie = implode(';', $cookie);
$ckfile = tempnam("/tmp", 'curl_cookies_');
file_put_contents($ckfile, $cookie);
$curl_log = fopen('temp/curl_debug.txt', 'w+'); // open file for READ and write
*/
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLINFO_HEADER_OUT => true, CURLOPT_ENCODING => "", CURLOPT_HTTPHEADER => ['Expect:'], CURLOPT_FOLLOWLOCATION => true, CURLOPT_AUTOREFERER => true, CURLOPT_MAXREDIRS => 10, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1);
// For $_POST i.e. forms with fields
if (count($_POST) > 0) {
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$formvars = [];
foreach ($_POST as $name => $post) {
$formvars = [$name => $post . " \n"];
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $formvars);
$html = curl_exec($ch);
curl_close($ch);
} else {
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$html = curl_exec($ch);
curl_close($ch);
if (!$html) {
$err = curl_error($ch);
TikiLib::lib('errorreport')->report($err ? $err : tr('mPDF: An error occurred retrieving page %0', $url));
return '';
}
}
include $this->location . 'mpdf.php';
$mpdf = new mPDF('');
$mpdf->useSubstitutions = true;
// optional - just as an example
$mpdf->SetHeader($url . '||Page {PAGENO}');
// optional - just as an example
$mpdf->CSSselectMedia = 'print';
// assuming you used this in the document header
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$mpdf->setBasePath($url);
$mpdf->WriteHTML($html);
return $mpdf->Output('', 'S');
// Return as a string
}