
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
node-poppler
Advanced tools
Asynchronous node.js wrapper for the Poppler PDF rendering library
The node-poppler module was created out of a need for a PDF-to-HTML conversion module at Yeovil District Hospital NHSFT to convert clinical documents in PDF format to HTML.
Install using yarn
:
yarn add node-poppler
Or npm
:
npm install node-poppler
node-poppler's test scripts use yarn commands.
Windows and macOS/Darwin binaries are provided with this repository.
For Linux users, you will need to download the poppler-data
and poppler-utils
binaries separately.
An example of downloading the binaries on a Debian system:
sudo apt-get install poppler-data
sudo apt-get install poppler-utils
If you do not wish to use the included macOS binaries, you can download the latest versions with Homebrew:
brew install poppler
Once they have been installed, you will need to pass the poppler-utils
installation directory in as parameters to an instance of the Poppler class:
const { Poppler } = require('node-poppler');
const poppler = new Poppler('./usr/bin');
const { Poppler } = require('node-poppler');
API Documentation can be found here
options
object requires at least one of the following to be set: jpegFile
; pdfFile
; pngFile
; psFile
; svgFile
; tiffFile
.
Example of an async await call poppler.pdfToCairo, to convert only the first and second page of a PDF file to PNG:
const { Poppler } = require('node-poppler');
const file = 'test_document.pdf';
const poppler = new Poppler();
const options = {
firstPageToConvert: 1,
lastPageToConvert: 2,
pngFile: true
};
const outputFile = `test_document.png`;
const res = await poppler.pdfToCairo(file, outputFile, options);
console.log(res);
Every field of the options
object is optional.
Example of calling poppler.pdfToHtml with a promise:
const { Poppler } = require('node-poppler');
const file = 'test_document.pdf';
const poppler = new Poppler();
const options = {
firstPageToConvert: 1,
lastPageToConvert: 2
};
poppler.pdfToHtml(file, options).then((res) => {
console.log(res);
});
Every field of the options
object is entirely optional.
Example of calling poppler.pdfToText with a promise:
const { Poppler } = require('node-poppler');
const file = 'test_document.pdf';
const poppler = new Poppler();
const options = {
firstPageToConvert: 1,
lastPageToConvert: 2
};
poppler.pdfToText(file, options).then((res) => {
console.log(res);
});
Please see CONTRIBUTING.md for more details regarding contributing to this project.
node-poppler
is licensed under the MIT license.
2.0.0 (2020-11-03)
options
object parameter for all functions has been moved to the end. i.e. Poppler.pdfToText(options, file, outputFile)
is now Poppler.pdfToText(file, outputFile, options)
.This allows for easier use of the functions as users no longer have to place an undefined parameter if no options are provided. Poppler.pdfToText(undefined, file, outputFile)
can now be called instead like Poppler.pdfToText(file, outputFile)
.
FAQs
Asynchronous Node.js wrapper for the Poppler PDF rendering library
The npm package node-poppler receives a total of 16,598 weekly downloads. As such, node-poppler popularity was classified as popular.
We found that node-poppler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.