Php – way to hide header and footer in a pdf file created with FPDF in PHP

fpdfpdfPHP

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.

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

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

Any help will be appreciated!

Best Answer

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
        }
    }
}
Related Topic