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


PHP mPDF::startPageNums方法代码示例

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


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

示例1: mpdf_output


//.........这里部分代码省略.........
        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 {
                    if ($pdf_template_pdfpage_page > $pagecount) {
                        $pdf_template_pdfpage_page = $pagecount;
                    }
                }
                $tplId = $mpdf->ImportPage($pdf_template_pdfpage_page);
                $mpdf->UseTemplate($tplId);
            }
        }
        $user_info = get_userdata($post->post_author);
        $mpdf->SetAuthor($user_info->first_name . ' ' . $user_info->last_name . ' (' . $user_info->user_login . ')');
        $mpdf->SetCreator('wp-mpdf');
        //The Header and Footer
        global $pdf_footer;
        global $pdf_header;
        $mpdf->startPageNums();
        // Required for TOC use after AddPage(), and to use Headers and Footers
        if ($pdf_html_header) {
            $mpdf->SetHTMLHeader($pdf_header);
        } else {
            $mpdf->setHeader($pdf_header);
        }
        if ($pdf_html_footer) {
            $mpdf->SetHTMLFooter($pdf_footer);
        } else {
            $mpdf->setFooter($pdf_footer);
        }
        if (get_option('mpdf_theme') != '' && file_exists($templatePath . get_option('mpdf_theme') . '.css')) {
            //Read the StyleCSS
            $tmpCSS = file_get_contents($templatePath . get_option('mpdf_theme') . '.css');
            $mpdf->WriteHTML($tmpCSS, 1);
        }
        //My Filters
        require_once dirname(__FILE__) . '/myfilters.inc.php';
        $wp_content = mpdf_myfilters($wp_content);
        if (get_option('mpdf_debug') == true) {
            if (!is_dir(dirname(__FILE__) . '/debug/')) {
                mkdir(dirname(__FILE__) . '/debug/');
            }
            file_put_contents(dirname(__FILE__) . '/debug/' . get_option('mpdf_theme') . '_' . $pdf_ofilename . '.html', $wp_content);
        }
        //die($wp_content);
        $mpdf->WriteHTML($wp_content);
        /**
         * Allow to process the pdf by an 3th party plugin
         */
        do_action('mpdf_output', $mpdf, $pdf_filename);
        if (get_option('mpdf_caching') == true) {
            file_put_contents(mpdf_getcachedir() . get_option('mpdf_theme') . '_' . $pdf_ofilename . '.cache', $post->post_modified_gmt);
            $mpdf->Output(mpdf_getcachedir() . get_option('mpdf_theme') . '_' . $pdf_ofilename, 'F');
            if ($outputToBrowser == true) {
                $mpdf->Output($pdf_filename, 'I');
            }
        } else {
            if ($outputToBrowser == true) {
                $mpdf->Output($pdf_filename, 'I');
            }
        }
    }
}
开发者ID:Alinea-Interactive,项目名称:wp-mpdf,代码行数:101,代码来源:wp-mpdf.php


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