I need to fetch some part from a pdf file (e.g. with pdftk). The page numbers as given in the table of contents are logical numbers (for example Roman numbers I to XX in the front-matter, main-matter starting with Arabic 1, although being the 21st physical page). Can I get physical numbers of pages for a particular part of a generated document (section, subsection, paragraph...)?
A) The get the "physical" number of a page of a PDF document, there are different possibilities, for example:
B) "I need to fetch some part from a pdf file". For this you do not necessarily need to know the physical page numbers. For example you could use the selectp package. For example
will allow only pages i (1; 1 of 3) and 1 (3 of 3) to be output. The order is not random but must be the order that the pages are produced; normally this means the numbers must always increase.
With roman numbers: 1-3, 1-3 prints the pages i-iii, 1-3
and 0, 1-3 prints the pages 1-3.
It needs a complete compiled file before use! (And you must translate e.g. i to 1, but that should not be an issue.)
Just a few lines to complete Stephen's answer for people using the memoir class:
Because you reset the foot for all styles, it will be changed on all pages (even for chapter and title pages).