How to get the total number of pages in RML template?

rml

Solution

After spending a considerable amount of time, I found this:

At the end of the `<story>`, add:

<namedString id="lastPage"><pageNumber/></namedString>

To display pagination, use:

Page <pageNumber /> / <getName id="lastPage" default="0" />

Problem

There is a tag in RML, `<pageNumber>`, that displays the the current page number. But how can I get the total number of pages of the generated PDF document? I would like to add a pagination with something like "Page 1/2", "Page 2/2": ``` Page <pageNumber /> / <pageCount> ``` But the `<pageCount>` tag doesn't exist.

Original source