Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Different header and/or footer

Avatar

Former Community Member
Hello.

I want to know if it is possible to create a pdf template that manages different header and/or footer depending on the number of data record to display.

I try to explain better.

Depending on the number of record I need different header or footer on the the first page and the following: if the data record fill only the first page I need a header and a footer of one kind, if the data record fill more than one page I need a header and a footer of another kind and so on...



Is there anything I can do to get around this? Thanks!
6 Replies

Avatar

Level 5
This can be achieved using script. This is just my thought there could be a better way...<br />1. Divide your form in to different subforms. (You probably did already.)<br />2. Make two different header and footer based on your requirement.<br />3. Select the Subform Header2 and Footer2 and type the following JavaScript code in initialize event<br /> this.presence = "hidden"<br />4. Trap the following to a variable xfa.host.numPages which gives you current total number of pages. Based on the situation you described I would use the following JavaScript code in 'docReady' event of the form object selecting the form object in Hirrorcy veiw.<br /> var np //number of pages<br /> np = xfa.host.numPages<br /> if (np != 1) {<br /> //form1.<subformname>.presence = <value><br /> form1.Header1.presence = "hidden"<br /> form1.Header2.presence = "visible"<br /> form1.Footer1.presence = "hidden"<br /> form1.Footer2.presence = "visible"<br /> }<br /><br />Hope this helps.....<br /><br />Good luck,<br />SekharN<br />www.lawson.com

Avatar

Former Community Member
Thank you for help.



But my template doesn't work very well because it seems to have only one page: variable xfa.host.numPages always returns 1 and variable xfa.host.currentPage starts from -1.



Bye

Giorgio Prossen

Avatar

Former Community Member
Initialize would be too early to get a good number of pages from xfa.host.numPages because the form hasn't been laid out and it doesn't yet know how many pages it will be. Try in doc:ready and see if that works better.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
I used a message box in the docReady event of form and body subform and i didn't see any change of numPages value: this number has correct value only in docClose event.



My goal is, depending on current page number, to use different header and footer.

Master page contains three content area: one for header, one for body and one for footer.

I have many subforms: more for headers and footers and one for data to display.



Bye

Giorgio Prossen

Avatar

Former Community Member
Giorgio_Prossen@adobeforums.com wrote:

> I used a message box in the docReady event of form and body subform and i didn't see any change of numPages value: this number has correct value only in docClose event.

>

> My goal is, depending on current page number, to use different header and footer.

> Master page contains three content area: one for header, one for body and one for footer.

> I have many subforms: more for headers and footers and one for data to display.

>

> Bye

> Giorgio Prossen



Giorgio,

Try the layout:ready event. This event is triggered after the Layout DOM is created. The Layout

DOM contains information regarding pagination, such as page numbers, headers, footers, etc. To get

the number of pages, you should use xfa.layout.pageCount() rather than xfa.host.numPages.



--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com

Avatar

Former Community Member
Giorgio_Prossen@adobeforums.com wrote:

> I used a message box in the docReady event of form and body subform and i didn't see any change of numPages value: this number has correct value only in docClose event.

>

> My goal is, depending on current page number, to use different header and footer.

> Master page contains three content area: one for header, one for body and one for footer.

> I have many subforms: more for headers and footers and one for data to display.

>

> Bye

> Giorgio Prossen



Giorgio,

Try the layout:ready event. This event is triggered after the Layout DOM is created. The Layout

DOM contains information regarding pagination, such as page numbers, headers, footers, etc. To get

the number of pages, you should use xfa.layout.pageCount() rather than xfa.host.numPages.



--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com