rajimurali
asked on
Change footer for the last page in Fpdf
Hi,
I am using FPDF to generate pdf files on the fly from PHP.
I would like to change the footer of the last page alone. Is this possible and if so how?
Thanks
I am using FPDF to generate pdf files on the fly from PHP.
I would like to change the footer of the last page alone. Is this possible and if so how?
Thanks
Of course it is possible. Please post the code you are using now and tell us how we might know that we are creating the last page. Thanks, ~Ray
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That sounds exactly like the logic I would have used. Glad you got it on track. ~Ray
Hi,
I have exactly the same request as Raji but couldn't manage to apply his solution...
In my Footer() method, I need to set a specific footer for the last page of the pdf generated. The problem is that the number of pages can change as the pdf content is dynamically generated so I can't use a constant value. I tried to use the '{nb}' alias as a variable for the number of pages but it doesn't seem to work.
Here is my code :
Thanks for your help
I have exactly the same request as Raji but couldn't manage to apply his solution...
In my Footer() method, I need to set a specific footer for the last page of the pdf generated. The problem is that the number of pages can change as the pdf content is dynamically generated so I can't use a constant value. I tried to use the '{nb}' alias as a variable for the number of pages but it doesn't seem to work.
Here is my code :
function Footer()
{
if($this->PageNo() < '{nb}') {
$this->SetY(-20);
$this->SetFont('Arial','',8);
$this->Cell(0,3,"content for the first pages",0,1,'C');//never displayed as '{nb}' is not defined yet I guess
}
else {
$this->SetY(-20);
$this->SetFont('Arial','',8);
$this->Cell(0,3,"content for the last page",0,1,'C');//always displayed
}
$this->SetFont('Arial','',8);
$this->SetTextColor(0,0,0);
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,1,'C');
}
Thanks for your help
Hi,
Posted a solution here: https://www.experts-exchange.com/questions/26093240/Change-footer-for-the-last-page-in-Fpdf.html
Hope that helps!
Cyril
Posted a solution here: https://www.experts-exchange.com/questions/26093240/Change-footer-for-the-last-page-in-Fpdf.html
Hope that helps!
Cyril
Hi,
Sorry, the correct solution url is: https://www.experts-exchange.com/questions/27181516/FPDF-Set-specific-footer-only-for-the-last-page.html
Cyril
Sorry, the correct solution url is: https://www.experts-exchange.com/questions/27181516/FPDF-Set-specific-footer-only-for-the-last-page.html
Cyril