Forum How do I...?

How do I re-trigger function registered via registerPostLayoutFunc in Prince16?

MartinM
Hi,

I need to fill an empty space of undetermined length at the end of the page with dummy lines. After several unsuccessful attempts I came across the registerPostLayoutFunc method, which should be the exact tool for the task.

BUT... According to the documentation it should re-trigger itself if last run modified the DOM structure. The problem is it only runs once.

The idea is as follows:
I am appending a bunch of dummy lines at the end of the page which makes the content overlap on 2 pages and then I am trying to delete one line of dummy text via el.removeChild(el.lastElementChild) in each run of post layout function until the number of pages (Prince.pageCount) is 1.

But, as I've said, the post layout function only runs once (even if I return true when pageCount > 1) and then the PDF is generated.

What do I need to do to re-trigger the function after each layout pass?