Help for creating a plugin to support inline preview of citations/reference in articles
Hello,
I am trying to add a plugin to preview of inline citations/references in pdf articles. The extension will be based mainly on this code https://github.com/erikscheurer/PDFRefPreview
The code is on js and works on most of the pdfs shown in browser, when that js is run using bookmark. Since zotero is based on firefox, we should be able to use it on pdfs shown by zotero reader too.
I know a little bit of javascript and trying to test this code on zotero reader. Is there any mailing list where plugin developers help each other to start. I tried reading API documentation, they are mostly about interacting with database and items and very little about interacting with pdf articles in zotero reader or I might be missing something.
I am using javascript API in developer tools to run some code snippets from the above-mentioned source. When I view an article in zotero reader, I do not find getDestinations() method in pdfDocument object . The partial code is here, hope somebody can give me some hint on this:
---
const myReader=Zotero.Reader; //zotero reader object to access the pdf
const v=Object.values(myReader);
const parentWindow=v[3][0]._iframeWindow; //inside iframe we have pdf, 0 means the first pdf,
const doc=parentWindow.document; //doc object inside iframe
const e=parentWindow.eval('PDFViewerApplication');//the pdfviewer application from pdfjs
const t=doc.getElementById('viewer'); //the viewer div, where we will add preview div
const pdfDocKeys=Object.keys('e.pdfDocument); //check keys in pdfDocument
r = await e.pdfDocument.getDestinations(); // should return the reference mapping and bookmarks, works in browser, but in zotero, pdfDocument has 3 attributes _pdfInfo, _transport, annotationStorage, nothing about getDestinations()
---
Can anyone please help me with how I should approach to develop this extension?
Thank you.
I am trying to add a plugin to preview of inline citations/references in pdf articles. The extension will be based mainly on this code https://github.com/erikscheurer/PDFRefPreview
The code is on js and works on most of the pdfs shown in browser, when that js is run using bookmark. Since zotero is based on firefox, we should be able to use it on pdfs shown by zotero reader too.
I know a little bit of javascript and trying to test this code on zotero reader. Is there any mailing list where plugin developers help each other to start. I tried reading API documentation, they are mostly about interacting with database and items and very little about interacting with pdf articles in zotero reader or I might be missing something.
I am using javascript API in developer tools to run some code snippets from the above-mentioned source. When I view an article in zotero reader, I do not find getDestinations() method in pdfDocument object . The partial code is here, hope somebody can give me some hint on this:
---
const myReader=Zotero.Reader; //zotero reader object to access the pdf
const v=Object.values(myReader);
const parentWindow=v[3][0]._iframeWindow; //inside iframe we have pdf, 0 means the first pdf,
const doc=parentWindow.document; //doc object inside iframe
const e=parentWindow.eval('PDFViewerApplication');//the pdfviewer application from pdfjs
const t=doc.getElementById('viewer'); //the viewer div, where we will add preview div
const pdfDocKeys=Object.keys('e.pdfDocument); //check keys in pdfDocument
r = await e.pdfDocument.getDestinations(); // should return the reference mapping and bookmarks, works in browser, but in zotero, pdfDocument has 3 attributes _pdfInfo, _transport, annotationStorage, nothing about getDestinations()
---
Can anyone please help me with how I should approach to develop this extension?
Thank you.
-
dstillmanhttps://groups.google.com/g/zotero-dev
-
mdelahiThank you very much, do not know how I did not see dev:start page.