How to get all sections total page count in post pagination script?

Hi everyone,

If I have 3 print sections and I need to change the styling of a particular element in section number 3.

How do I get the final total page count of all the sections (in Designer including any clone section created dynamically), while targeting specific element to change its style? Im guessing this needs to be done in post pagination script.

For example:

Section 1 = First sheet
Section 2 = Overflow (variable content) sheet
Section 3 = Last sheet - (I need to change styling of an element here)

In post pagination script something like so:

var totalPages = Section1.totalPage + Section2.totalPage + Section3.totalPage;

if(totalPages = 5){
   // change css
   Section3.query("box1").css("background", "white");
}

Is this possible?

Also please do not ask to change sheet configuration, as I already tried different sorts of ways to do what Im trying to achieve.

Thanks in advanced.

Kind regards
E

Update:

I can get the overall total page by using merge.pagination.PageCount , but wont work when in designer and disabled the current section. As the cloned sections are not taken into account.

And this is why Im getting incorrect results. Im guessing the cloned sections are only evaluated in runtime.

The property merge.pagination.pageCount is indeed the correct one.

I assume that this is because the cloned Print Context Sections are also not visible when viewing the result in Preview mode.

1 Like