"Real" page of a PDF

I have several scripts that copy the current page from an open PDF book. I have noticed that Devonthink (using Skim as viewer) sometimes “knows” where the page count of a book begins, meaning, the page count goes from xii to 1 when the first chapter begins. The scripts that I have copy the “actual” page of the PDF. So xii is 12 and page 1 gets titled as 13. I’m wondering if there is a way to get at this “real” page number and copy that instead?

If you posted a simple example of the script, it might be easier to answer the questions.