Skip to Content
OpenPreview

Remember position

Reopen documents where the reader left off, with page, scroll position, zoom and rotation saved per file.

<DocViewer source={file} rememberPosition />

The viewer saves the page, the position on the page, zoom and rotation (for spreadsheets, the sheet; for pageless documents, the scroll position). With true it keeps up to 50 documents in localStorage, keyed by a fingerprint of the file's bytes, so a renamed copy still matches.

Use your own document id, store or limit:

<DocViewer
  source={url}
  rememberPosition={{
    key: `doc:${documentId}`,
    storage: sessionStorage, // anything with getItem and setItem
    limit: 200,
  }}
/>

loadPosition and savePosition are exported for syncing positions to your server.