Hi, I am trying to add bookmarks(or outlines) to a pdf file by pdf-lib in Javascript. Demo code can be run successfully in an NPM environment, but the transferred code in Zotero didn’t work.
I load the pdf-lib file by
var fileLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
fileLoader.loadSubScript('chrome://jasminum/content/scripts/pdf-lib.min.js')
The PDFLib
seems to be imported as a global object, I can use PDFLib in the Zotero Run Javascript window and the demo code works fine. But the code in the plugin didn’t work.
Then I look into the code in Zotfile, the pdfjs library seems to be wrapped in an HTML file. Maybe I can try to use pdf-lib like pdfjs in zotfile? As a newbie to javascript, I even don’t know where to get some useful data about this kind of library import? I hope someone cloud give me some clues about this.