Need to know which page an element is rendered?

Hi everyone,

I have a overflowing document. So pages will be dynamically be created. At the bottom of the content (passed all dynamic tables) , I have another table which I need to know which page it is in.

Is this possible?

Ive tried in my pagination script “html” selector, when I log “logger.info(results)” and copy the value to VScode text editor, I can see the whole html source, I can see the particular table I want and its after a

<span style="top: 0px; height: 927.303px; background: transparent none repeat scroll 0% 0%; -moz-user-select: none;" class="page_breakverticalspacer intersect_ignore pagination" id="pagebreak_3"></span>

But some reason when I tried to query query("#pagebreak_3") its returning nothing. I was thinking maybe I can query this element to know where exactly the last table ended up.

I would’nt have to do this if there a way for me to check for total pages without the automatically added blank page.

Thank you in advanced.

Kind regards,
E

Can you share an anonymized version of your Template so I can play around with it?

Use a post pagination script with a selector that targets the table and call results.info(). That gives you a PaginationInfo object which includes the page number of the element.

We don’t allow scripts to access system elements like page breaks directly, that is why your query() call doesn’t return anything. There are ways around it, but calling info() is the recommended approach.

Note that there is also a property that gives you the page count of a section in a post pagination script, should you need that.

Thanks Sander. This seems like the way to go.

Cheers!