Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[PDF embed API] set scroll or page

Explorer ,
Feb 02, 2021 Feb 02, 2021

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.

1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 02, 2021 Feb 02, 2021

I have a CodePen here that demonstrates this.

Translate
Community Expert ,
Feb 02, 2021 Feb 02, 2021

I have a CodePen here that demonstrates this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 02, 2021 Feb 02, 2021
I feel very ignorant and stupid I do not know what I'm doing I don't know
what y'all want can't you just send me a text and put in plain English the
steps one two three please I was just ready to break my phone
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 02, 2021 Feb 02, 2021

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 03, 2021 Feb 03, 2021
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources