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


PHP mPDF::SetDocTemplate方法代码示例

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


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

示例1: mPDF

<?php

include_once "../mpdf.php";
$mpdf = new mPDF('', '', '', '', 15, 15, 47, 16, 9, 9);
$mpdf->SetImportUse();
$mpdf->SetDocTemplate('sample_logoheader2.pdf', 1);
// 1|0 to continue after end of document or not - used on matching page numbers
//===================================================
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
//===================================================
$mpdf->RestartDocTemplate();
//===================================================
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
//===================================================
$mpdf->Output();
exit;
开发者ID:rromerouchiha,项目名称:quinielas,代码行数:26,代码来源:example42_MPDFI_templatedoc.php

示例2: mpdf_output

function mpdf_output($wp_content = '', $do_pdf = false, $outputToBrowser = true, $pdfName = '', $templatePath = '')
{
    global $post;
    $pdf_ofilename = $post->post_name . '.pdf';
    if (!empty($pdfName)) {
        $pdf_filename = $pdfName . '.pdf';
    } else {
        $pdf_filename = $pdf_ofilename;
    }
    /**
     * Allow to override the pdf file name
     */
    $pdf_filename = apply_filters('mpdf_output_pdf_filename', $pdf_filename);
    /**
     * Geshi Support
     */
    if (get_option('mpdf_geshi') == true) {
        require_once dirname(__FILE__) . '/geshi.inc.php';
        $wp_content = ParseGeshi($wp_content);
    }
    /**
     * Run the content default filter
     */
    $wp_content = apply_filters('the_content', $wp_content);
    /**
     * Run the mpdf filter
     */
    $wp_content = mpdf_filter($wp_content, $do_pdf);
    if ($do_pdf === false) {
        echo $wp_content;
    } else {
        $cacheDirectory = mpdf_getcachedir();
        if (!is_dir($cacheDirectory . 'tmp')) {
            @mkdir($cacheDirectory . 'tmp');
        }
        define('_MPDF_PATH', dirname(__FILE__) . '/mpdf/');
        define('_MPDF_TEMP_PATH', $cacheDirectory . 'tmp/');
        define('_MPDF_TTFONTDATAPATH', _MPDF_TEMP_PATH);
        require_once _MPDF_PATH . 'mpdf.php';
        global $pdf_margin_left;
        global $pdf_margin_right;
        global $pdf_margin_top;
        global $pdf_margin_bottom;
        global $pdf_margin_header;
        global $pdf_margin_footer;
        global $pdf_html_header;
        global $pdf_html_footer;
        if ($pdf_margin_left !== 0 && $pdf_margin_left == '') {
            $pdf_margin_left = 15;
        }
        if ($pdf_margin_right !== 0 && $pdf_margin_right == '') {
            $pdf_margin_right = 15;
        }
        if ($pdf_margin_top !== 0 && $pdf_margin_top == '') {
            $pdf_margin_top = 16;
        }
        if ($pdf_margin_bottom !== 0 && $pdf_margin_bottom == '') {
            $pdf_margin_bottom = 16;
        }
        if ($pdf_margin_header !== 0 && $pdf_margin_header == '') {
            $pdf_margin_header = 9;
        }
        if ($pdf_margin_footer !== 0 && $pdf_margin_footer == '') {
            $pdf_margin_footer = 9;
        }
        if (empty($pdf_html_header)) {
            $pdf_html_header = false;
        }
        if (empty($pdf_html_footer)) {
            $pdf_html_footer = false;
        }
        global $pdf_orientation;
        if ($pdf_orientation == '') {
            $pdf_orientation = 'P';
        }
        $cp = 'utf-8';
        if (get_option('mpdf_code_page') != '') {
            $cp = get_option('mpdf_code_page');
        }
        $mpdf = new mPDF($cp, 'A4', '', '', $pdf_margin_left, $pdf_margin_right, $pdf_margin_top, $pdf_margin_bottom, $pdf_margin_header, $pdf_margin_footer, $pdf_orientation);
        $mpdf->SetUserRights();
        $mpdf->title2annots = false;
        //$mpdf->annotMargin = 12;
        $mpdf->use_embeddedfonts_1252 = true;
        // false is default
        $mpdf->SetBasePath($templatePath);
        //Set PDF Template if it's set
        global $pdf_template_pdfpage;
        global $pdf_template_pdfpage_page;
        global $pdf_template_pdfdoc;
        if (isset($pdf_template_pdfdoc) && $pdf_template_pdfdoc != '') {
            $mpdf->SetImportUse();
            $mpdf->SetDocTemplate($templatePath . $pdf_template_pdfdoc, true);
        } else {
            if (isset($pdf_template_pdfpage) && $pdf_template_pdfpage != '' && isset($pdf_template_pdfpage_page) && is_numeric($pdf_template_pdfpage_page)) {
                $mpdf->SetImportUse();
                $pagecount = $mpdf->SetSourceFile($templatePath . $pdf_template_pdfpage);
                if ($pdf_template_pdfpage_page < 1) {
                    $pdf_template_pdfpage_page = 1;
                } else {
//.........这里部分代码省略.........
开发者ID:Alinea-Interactive,项目名称:wp-mpdf,代码行数:101,代码来源:wp-mpdf.php

示例3: 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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();
    }
开发者ID:henryavila,项目名称:itop,代码行数:101,代码来源:itopwebpage.class.inc.php

示例4: mPDF

			<p id="tabledisplay-target-community-name" class="tabledisplay-community">' . $community_name . '</p>				
			<p id="tabledisplay-target-community-website" class="tabledisplay-community">' . $community_website . '</p>
			<p id="tabledisplay-target-community-email" class="tabledisplay-community">' . $community_email . '</p>

		</div>
		
		<div id="tabledisplay-owner">
			
			<p id="tabledisplay-target-owner-name" class="bold tabledisplay-owner">' . $owner_name . '</p>				
			<p id="tabledisplay-target-owner-website" class="tabledisplay-owner">' . $owner_website . '</p>
			<p id="tabledisplay-target-owner-infos" class="tabledisplay-owner">' . $owner_infos . '</p>

		</div>';
    $mpdf = new mPDF('', 'A4-L', 0, '', 0, 0, 0, 0, 0, 0, 'P');
    $mpdf->SetImportUse();
    $mpdf->SetDocTemplate(__PATH__ . '/templates/div-a4-tabledisplay.pdf', true);
    $mpdf->AddPage();
    $mpdf->WriteHTML($style, 1);
    $mpdf->WriteHTML($html);
    $filename = time() . '_' . randomString(10) . '.pdf';
    $link = __URL__ . '/cache/documents/' . $filename;
    $mpdf->Output(__PATH__ . '/cache/documents/' . $filename, 'F');
    if (isset($_SESSION['errors'])) {
        $codes = '';
        $messages = '';
        foreach ($_SESSION['errors'] as $error) {
            $codes .= $error['code'] . ' ';
            $messages .= $error['message'] . ' ';
        }
        $apiResponseHeader['error'] = true;
        $apiResponseHeader['code'] = $codes;
开发者ID:089,项目名称:FFNRW-PRGenerator,代码行数:31,代码来源:route-generate-tabledisplay.php


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