Copy link to clipboard
Copied
Hi,
I'd like to ask if there is an API endpoints for setting the scroll position or page to view.
I understand that there is events like PAGE_VIEW, PREVIEW_PAGE_VIEW_SCROLLED, to record the current page and scroll location.
this is to implement a function to resume the last reading location after the pdf is closed.
thanks.
I have a CodePen here that demonstrates this.
Copy link to clipboard
Copied
I have a CodePen here that demonstrates this.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
calm down bro.
please share the issue you're facing now or what you're not sure about, I believe this community could help you.
Copy link to clipboard
Copied
The steps are in the code but I'll outline them here. The basic concept is this, every time there is a page change, you store the page number as either a cookie or in local storage. So the order of operations is this...
When the PDF is done rendering, check to see if a page number has been stored previously for the URL, if it does, read it and scroll to that page. If not, do nothing. Then each time the page changes, store the current page number.