Print Header only on first page of PDF

Hi,

Where can i look to edit the code so that a header is only created on the first page of a PDF?

As a work-around I’ve always put the header in the page content, but seems odd not to be able to set a header for just the first page?

The reason I’d like to move the info to the header is so that i can easily copy the header data to other templates without endlessly messing up the html in the page content. The PDF creation is really buggy and challenging .

As a non-upgrade safe hack, you could try changing this function

To become like this

    public function Header(): void
    {
         if ($this->page == 1) {
             $this->writeHTMLCell(0, 0, '', '', $this->getHtmlHeader());
         }
    }

I didn’t test this, I just made it up right now, I have no idea if it will work, or fail miserably.

You are kidding me!!! OMG i spent hours on that - the teeniest bit of hope i have to keep going is that i was editing the writeheader in a similar way in TCPDFEngine, but getting nowhere.

Thank you so much
:upside_down_face: :grinning:

1 Like