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
rajimuraliAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
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
rajimuraliAuthor Commented:
Thanks. I found a solution.  What I did was to suppress the footer after the first page and then just before calling the $pdf->Output statement, I restored the footer again.  This printed the footer only for first and last pages.  

Thanks
Raji

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
That sounds exactly like the logic I would have used.  Glad you got it on track.  ~Ray
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

wazzzzzaCommented:
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 :
		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');
		}

Open in new window


Thanks for your help
wazzzzzaCommented:
wazzzzzaCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.