Change footer in last page if autobreak is on

  • Paweł

    Paweł - 2010-01-09


    I need to change sth. in footer in last page, when AutoPageBreak is used.

    If somebody have already solved such a problem please share it here.


  • Paweł

    Paweł - 2010-01-11

    I use TCPDF class

  • Nicola Asuni

    Nicola Asuni - 2010-01-11

    Before the last page you set the new footer and then call AddPage().

  • Paweł

    Paweł - 2010-01-11

    I have temporary solution : I created another object, and i've done the same
    operation's on him.
    The first object tells me only, how much pages i have.
    The twice object is prepared to outpoot with changed last page (i added
    condition in function footer if (getnumpages == lastpage))

    nicolaasuni <--- "Before the last page " - what was the problem, because i
    didn't know wchich page is last

  • Paweł

    Paweł - 2010-01-11

    Which - sorry for my english

  • lai yong

    lai yong - 2010-02-24

    may I know is there any solution for this?

  • Paweł

    Paweł - 2010-02-24

    As I said in my post. You can use session variables to count the pages.

  • Nicola Asuni

    Nicola Asuni - 2010-02-24

    You can extend the TCPDF class and overwrite the following methods:

    protected $last_page_flag = false;
    public function Close() {
        $this->last_page_flag = true;
    public function Footer() {
        if ($this->last_page_flag) {
            // ... footer for the last page ...
        } else {
            // ... footer for the normal page ...
  • lai yong

    lai yong - 2010-02-25

    thanks nicola. It's work perfect now..


Log in to post a comment.