Forum How do I...?

Use Javascript to get PDF page labels

jenniferflint
We are using Javascript to obtain the page number information from our Prince-generated PDFs and insert them into a database application, but these values do not correspond to the page labels in the PDF so frontmatter begins on page 1, when the reality is that the book content begins on page 1. We currently have a formula to help fix this issue, but are wondering if there is a way to simply obtain the page labels from the PDF via Javascript and report this directly in a log file.
mikeday
I think we would need to add the page labels to the box tree as currently page styling is not accessible to JavaScript. Another possibility might be to use a PDF tool to dump the page labels.
jenniferflint
Following up on this topic with a bit of a twist. When a chapter or article PDF ends with a floating object, our current Javascript ignores those items when reporting the lastbox.pageNum back to our database system, so our pagination is inaccurate. Is there an easy way to report the page number of the final floating object in a document using Javascript? I've attached the Javascript we're using to report this content at present. Any advice would be greatly appreciated. Thanks!
  1. jb-prince.js0.9 kB