pdftohtmljs - pdf2htmlEx shell wrapper for Node.js
pdftohtmljs provides access to pdf2htmlEX via shell in node.js programs.
Requirements
If you've docker env setup, just install it via docker
alias pdf2htmlEX="docker run -ti --rm -v ~/pdf:/pdf iapain/pdf2htmlex pdf2htmlEX"
~/pdf on host computer will be used as volume
PDF2HTMLEX path is resolved usiing following:
- first it looks into env variable
PDF2HTMLEX_BIN
. - then it fallbacks to
bin
option. - then it fallbacks to system path.
Installation
via npm:
npm install pdftohtmljs
Usage
const pdftohtml = // See presets (ipad, default)// Feel free to create custom presets// see https://github.com/fagbokforlaget/pdftohtmljs/blob/master/lib/presets/ipad.jsconst convert = async { const converter = file output // If you would like to tap into progress then create // progress handler converter try // convert() returns promise await converter catch err console } // call method
Command line usage
npm install pdftohtmljs -g
pdftohtmljs sample.pdf
You may optionally provide your own filename and preset
pdftohtmljs sample.pdf sample.html ipad
Tests
$ npm test
NodeJS Support
This library support nodejs v8+