Viewing 10 posts - 1 through 10 (of 11 total)
  • Author
    Posts
  • #5743 Reply

    Khaled Alqasrawi

    is there a possible way to set a listener to be triggered when the user change the page and move to another page ?

    #5744 Reply

    Dr. Plug
    Moderator

    Hello Khaled,

    Thanks very much for your question. I’d just like to confirm that you are requesting a notification after a page changing event within your app? Are you developing on iOS or Android, or both? We will address this question, in the meantime, and report back to you shortly.

    Cheers,

    Dr. Plug

    #5748 Reply

    Dr. Plug
    Moderator

    Hi Khaled,

    In Android, there is a way to get the information from page changing. To get the info, you can use ‘onGoToPage(int pageIdx, int pageCount)’, a callback method in the ReaderListener class. This method is called whenever page moving events occur.

    The first int type parameter named ‘pageIdx’ represents the target page index. The index is zero-based. The other int type parameter named ‘pageCount’ shows the page count of the current PDF document. You can see the sample code in the SimpleDocumentReader class.

    /**
    * It is called when the page move the event occurred.
    *
    * @param pageIdx
    * target page index
    * @param pageCount
    * total page count
    */
    @Override
    public void onGoToPage(int pageIdx, int pageCount) {
    mControlView.updatePageNumber(pageIdx, pageCount);
    }

    Happy Holidays!

    Dr. Plug

    #6848 Reply

    Nicholas McComb

    Hello Dr. Plug,

    What about when a user clicks a link in a PDF (to go to another page in the PDF) or swipes left or right to a new page?
    It doesn’t seem to call onGoToPage when these events occur.

    Where can we find these events?

    Thanks!
    Nicholas.

    #6849 Reply

    Dr. Plug
    Moderator

    Hello Nicholas,

    Either you swap the page or click a link, onGoToPage(); method is called.
    you can verify it by

    put it into the onCrreate method inside
    mReader.setReaderListener(new ReaderListener())

    Thank you
    Dr. Plug

    • This reply was modified 1 year, 9 months ago by  Dr. Plug.
    • This reply was modified 1 year, 9 months ago by  Dr. Plug.
    #6852 Reply

    Nicholas McComb

    Hi Dr Plug,

    How do we get the page number of the page that the user has come from before onGoToPage() is called?
    If the user has swiped left/right or gone to a page from a link in the PDF?

    Thanks,
    Nicholas McComb.

    #6853 Reply

    Nicholas McComb

    Hi Dr Plug,

    Never mind, i figured it out. It’s late here in Australia 😛
    Thanks for the help!

    Regards,
    Nicholas McComb.

    #6854 Reply

    Dr. Plug
    Moderator

    Hello,

    Sorry that we didn’t responded you on time due to the time difference. Glad to hear that you figure it out.
    In case you have further question feel free to ask.

    Thank you
    Dr. Plug

    #11257 Reply

    Jose Bravo

    Hi

    The method onGoToPage(int pageIdx, int pageCount) was removed from the interface? I updated my PlugPDF framework and it stopped working.

    The version I downloaded today doesn’t have the method onGoToPage(int pageIdx, int pageCount) in the SimpleDocumentReaderListener file, just the onLoadFinish.

    Please let me know how can I get notified when a page changed in the last version of PlugPDF.

    Thanks!

    #11258 Reply

    Jose Bravo

    Hi,

    I found that the new SimpleDocumentReader provided is missing this portion of code:

    if (mListener != null) {
    mListener.onGoToPage(pageIdx, pageCount);
    }

    in the method onGoToPage(int pageIdx, int pageCount), the copy I downloaded a few months ago does have that portion of code.

    Thanks!

Viewing 10 posts - 1 through 10 (of 11 total)
Reply To: How to get notified when a page has been changed
Your information: