pdftotextjs - pdftotext shell wrapper for Node.js
pdftotextjs provides access to pdftotext
via shell in nodejs. You'll
need pdftotext
which comes with poppler-utils
.
- Ubuntu/Debian
sudo apt-get install poppler-utils
. - MacOSX
sudo port install poppler
orbrew install xpdf
. - Windows
download and install
Xpdf.
Installation
via npm:
$ npm install pdftotextjs
Usage
Asynchronous example
const pdftotext = ;const pdf = 'test/pdfs/sample.pdf'; // Convert first page only// These options will be passed to pdftotext// You may use any valid optionpdf; pdf console;);
Synchronous example
const pdftotext = ;const pdf = 'test/pdfs/sample.pdf'; const data = pdf; // returns bufferconsole;
Tests
$ npm test