Navigate to page in Zotero reader

65 views
Skip to first unread message

jl

unread,
Apr 30, 2025, 6:34:57 AMApr 30
to zotero-dev
Hi!

I am trying to navigate to a page in the Zotero reader. However, the code below does not work with "Run Javascript". The navigate method is defined but nothing happens when I run the code. What is the correct way to do this?

Thanks!

const window = Zotero.getMainWindow();
const reader = Zotero.Reader.getByTabID(window.Zotero_Tabs.selectedID);
await reader._internalReader._primaryView.navigate({
    pageIndex: "5"
})

jl

unread,
May 5, 2025, 2:03:31 PMMay 5
to zotero-dev
To answer my own question, navigate is exposed through the reader object so the code below works. I don't think setSelectedAnnotations (or something similar) is exposed from the reader. Would be great to have that so this works `reader.setSelectedAnnotations([annotationItem.key])` (current error is `Error: Permission denied to access property "length"`)


window = Zotero.getMainWindow();
const reader = Zotero.Reader.getByTabID(window.Zotero_Tabs.selectedID);
reader.navigate({pageIndex: 0})
Reply all
Reply to author
Forward
0 new messages