How to use recognizePDF.js in a stand-alone fashion

Hi folks, devs and community,
I was wondering if it would be possible for us to utilize the recongnizePDF.js in order to extract meta-data and fetch bib entries in a stand-alone fashion from cli. Eventually I would like to call something along the lines of << node recongizePDF.js --input path/to/pdf/folder --output path/to/bib >>.

Where recongnizePDF.js will take as input the directory with all pdfs and extract from them metadata and bib entries and store them in the output file .bib or .txt located in the output path.

Which files to I need besides to recognizePDF.js and q.js to achieve that? Is it even possible?

By running node recognizePDF.js it complains that it can't find Components module.

Disclaimer: I'm not very familiar with js or react so plz bear with my stupid questions, but I'm pretty good with python.

Thanks a bunch for all your help!
  • You will get better help for this type of question from the zotero-dev Google Group.
  • Honestly, though, I think this isn't going to work with any reasonably effort. recognizePDF -- like much of Zotero -- calls on a ton of different internal functions which in turn build on a whole slew of mozilla functions (especially for things that make web calls such as this) that are part of Zotero's build. Getting this to work outside of the context of a mozilla build isn't going to be fun.

    I see two options to get a commandline tool for this:
    1) read the code and look at what calls Zotero makes with what data and rewrite them as a standalone script (which could be in any programming language)
    2) Zotero has mentioned wanting to expose more functionality via CLI themselves. You could wait for that, though there's no ETA and this could just as well take years as it could take months.
  • Thanks folks,

    Number 1) is a bit out of stretch for me at the moment. Besides if things never translate to one to one between languages unless your'e fluent in both and quite familiar with API.
Sign In or Register to comment.