有没有一种方法可以在PHP中使用FPDF创建的pdf文件中隐藏页眉和页脚? [英] Is there a way to hide header and footer in a pdf file created with FPDF in PHP?

查看:121
本文介绍了有没有一种方法可以在PHP中使用FPDF创建的pdf文件中隐藏页眉和页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用PHP创建了带有FPDF的pdf文件.当我在其中插入页眉和页脚时,它们会自动显示在pdf文件的所有页面上.但是我想阻止这些页眉和页脚显示在第一页上,并从pdf文件的第二页开始显示它们.我已经在网上搜索了,但找不到解决方法.

I have created a pdf file with FPDF in PHP. When i insert the header and footers in it, they automatically gets displayed on all the pages of the pdf file. But i want to stop these header and footer from getting displayed on the first page and display them starting from the second page of the pdf file. I have searched the net but unable to find a solution.

换句话说,我想为我使用FPDF创建的pdf报告动态创建封面.

In other words i want to dynamically create a cover page for the pdf report i have created with FPDF.

任何人都可以从pdf文件的第一页给我一些有关如何执行hidinh页眉和页脚任务的提示!

Can anybody give me some tips on how to perform this task of hidinh header and footer from the first page in pdf file!

任何帮助将不胜感激!

推荐答案

这是一个简单的任务.请尝试以下操作:

That's an easy task. Try the following:

class PDF extends FPDF {
    ...

    function Header() {
        if ( $this->PageNo() !== 1 ) {
            // Add your stuff here
        }
    }

    function Footer() {
        if ( $this->PageNo() !== 1 ) {
            // Add your stuff here
        }
    }
}

这篇关于有没有一种方法可以在PHP中使用FPDF创建的pdf文件中隐藏页眉和页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆