Here is a link to adobe pagemap.xml files that can contain links to ids in xhtml pages in epub2 and to ncx page tables. Various examples can be found by a websearch.
https://www.safaribooksonline.com/bl...-ncx-pagelist/
And here are a few starting point in our own Wiki:
https://wiki.mobileread.com/wiki/Page_numbers
https://wiki.mobileread.com/wiki/Ado...tions#Page-map
https://wiki.mobileread.com/wiki/NCX
And by the way, the sample epub that was just posted by BeckyEbook correctly uses fragments in the opf guide section so parsing the opf guide will be needed as well.