Solved

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

Posted on 2011-03-22
1
1,473 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hosting images 4 31
mysqli insert query problems 4 22
How can I make this form submit to itself? 10 28
Checkout Page Input Field not aligned 1 23
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

832 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