Solved

TCPDF: How to have different headers/footers on different pages - using page groups or similar

Posted on 2011-03-22
1
1,548 Views
Last Modified: 2012-05-11
This is a follow on question from:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_26886352.html?sfQueryTermInfo=1+10+30+tcpdf

which I thought had solved the problem.

Unfortunately, the issue I have run in to is that I am dynamically generating content within the middle of the PDF which means I do not know what page number the last pages within the PDF will be - but I DO need to be able to specify a set header.

So for example:

Page 1: Cover page header
Page 2: Index page header
Page 3: Introduction header
Pages 4 -> n: Content pages header
Page n+1: Summary header
Page n+2: Contact details header

I thought it may be possible to use Page Groups to achieve this - however, the only output I seem to be able to get from Page Groups is the number of pages within them, rather than an actual page group ID.  If I had an ID, then I could substitute $page_group for $page in the previous example, and then do:

Page group 1: Cover page header
Page group 2: Index page header
Page group 3: Introduction header
Page group 4: Content pages header
Page group 5: Summary header
Page group 6: Contact details header

Has anybody managed to successfully do this?

Thanks,

Rob
0
Comment
Question by:freestate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 17

Accepted Solution

by:
psimation earned 500 total points
ID: 35922610
$this->getAliasNumPage() should give you the number of the page that you are on
$this->getAliasNbPages() should give you the total number of pages in the PDF

HTH?

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question