I'm using XSL-FO to generate PDF documents with one or more pages. However, if my document has one page I want to hide the {pageNumber}/{totalPage}
(the red rectangle area in the below picture), and only display when {totalPage} > 1
. How do I do that?
fo:simple-page-master
for the single page that uses a different region-name
for its fo:region-after
.fo:page-sequence-master
that selects the new fo:simple-page-master
for the single page using page-position="only"
. (See XSL-FO Different header/footer depending on page-position, https://stackoverflow.com/a/58343013/4092205, and https://www.w3.org/TR/xsl11/#page-position.)fo:static-content
that you direct to the fo:region-after
for regular pages, generate another fo:static-content
without the fo:page-number
and direct that to the fo:region-after
for the fo:simple-page-master
for the single page.fo:simple-page-master
for the single page, and that page will use the fo:static-content
that has a flow-name
that matches the region-name
of its fo:region-after
.So that's a few steps, but that's because there's some flexibility in what you can do with fo:page-sequence-master
selecting different page masters.