Sounds like the classic off-by one error to me.
PDF Pages are traditionally one-based, while many functions in PDFKit, i.e. page(at:) are zero based.
https://developer.apple.com/documentation/pdfkit/pdfdocument/page(at:)
Topic:
Media Technologies
SubTopic:
General
Tags: