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?
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
0
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
0

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
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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
0
wazzzzzaCommented:
0
wazzzzzaCommented:
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.