Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

Retrieve page number from PDFPage instance 5 years 1 month ago #14312

  • fabmar
  • fabmar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 2
  • Thank you received: 0
Hi team,
which is the correct way to retrieve the page number from a PDFPage and a PDFDoc instance?

Is the snippet below correct?
int currentPage;
PDFDoc *currentDoc = ... //Current doc instance
PDFPage *page = ... //page instance
for (int i = 0; i < [currentDoc pageCount]; i++) {
    if ([page advanceGetRef] == [[currentDoc page:i] advanceGetRef]) {
        currentPage = i;
        break;
    }
}

Thanks in advance.

Fabio Mariani

Please Log in or Create an account to join the conversation.

Retrieve page number from PDFPage instance 5 years 1 month ago #14313

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
no direct way to know page NO from PDFPage object.
if you need this feature, you can:
1.add private attribute to PDFPage. like "int pageno"
2.set this attribute in method [PDFDoc page].
then you can using [page pageno] to known page index.

but i don't recommand you to do this.
because, after create or delete page, the pageno may changes.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum