Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-poppler

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-poppler

Node.js wrapper for the Poppler PDF rendering library

  • 1.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.8K
increased by12.27%
Maintainers
1
Weekly downloads
 
Created
Source

node-poppler

GitHub Release npm version Build Status Coverage Status Dependabot Status code style: prettier

Promise-based node.js wrapper for the Poppler PDF rendering library

Intro

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.

Installation

Install using yarn:

yarn add node-poppler

Or npm:

npm install node-poppler

node-poppler's test scripts use yarn commands.

Linux support

Windows and OSX/Darwin binaries are provided with this repository. For Linux users, you will need to download the poppler-data and poppler-utils binaries seperately.

An example of downloading the binaries on a Debian system:

sudo apt-get install poppler-data
sudo apt-get install poppler-utils

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');

API

const { Poppler } = require('node-poppler');

API Documentation can be found here

Examples

poppler.pdfToCairo

options object requires atleast one of the following to be set: jpegFile; pdfFile; pngFile; psFile; svgFile; tiffFile.

Example of calling poppler.pdfToCairo with a promise, 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
};

await poppler.pdfToCairo(options, file).then((res) => {
	console.log(res);
});

poppler.pdfToHtml

Every field of the options object is entirely 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
};

await poppler.pdfToHtml(options, file).then((res) => {
	console.log(res);
});

poppler.pdfToText

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
};

await poppler.pdfToText(options, file).then((res) => {
	console.log(res);
});

Contributing

Please see CONTRIBUTING.md for more details regarding contributing to this project.

License

node-poppler is licensed under the MIT license.

Keywords

FAQs

Package last updated on 04 May 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc