Pdftotextjs
pdftohtml nodejs wrapper
Install / Use
/learn @fagbokforlaget/PdftotextjsREADME
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 popplerorbrew install xpdf. - Windows
download and installXpdf.
Installation
via npm:
$ npm install pdftotextjs
Usage
Asynchronous example
const pdftotext = require('pdftotextjs');
const pdf = new pdftotext('test/pdfs/sample.pdf');
// Convert first page only
// These options will be passed to pdftotext
// You may use any valid option
pdf.add_options(['-f 1', '-l 1']);
pdf.getText()
.then(function(result) {
console.log(result);
})
.catch(function (err) {
console.error(err);
});
Synchronous example
const pdftotext = require('pdftotextjs');
const pdf = new pdftotext('test/pdfs/sample.pdf');
const data = pdf.getTextSync(); // returns buffer
console.log(data.toString('utf8'));
Tests
$ npm test
Related Skills
node-connect
340.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.2kCommit, push, and open a PR
