TCPDF set different headers for different pages in one document

后端 未结 8 640
终归单人心
终归单人心 2021-02-08 04:50

Is there a way to have a different header logo for the 1st page in a document and different for the 2nd page?

I thought that changing the header data between adding page

相关标签:
8条回答
  • 2021-02-08 05:54

    Strange. I'm having the same issue, but this worked in my older version of TCPDF version:4.8.009 and I noticed the issue when I upgraded to 5.9.149.

    I compared the 2 and isolated the issue to the Header() function.

    I could force it to allow me to change the header and accept it by running this:

    $pdf->setHeaderTemplateAutoreset(true);
    
    0 讨论(0)
  • 2021-02-08 05:55

    The following worked for me,

    class MYPDF extends TCPDF{
        function header1(){
            //print whatever the header 1 is
        }
        function Header2(){         
            if($this->page==1){
                //print header 1 and whatever the header 2 is
            }else{
                //print just header 2   
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题