pdftoimage
v1.0.0
Published
Convert pdf to an image (pdftocairo)
Downloads
4,923
Readme
pdftoimage
npm module for converting a pdf file to an image (png, jpeg, tiff, svg) using pdftocairo from Poppler.
Installation
npm install pdftoimage
Usage
var pdftoimage = require('pdftoimage');
var file = 'sample.pdf';
// Returns a Promise
pdftoimage(file, {
format: 'png', // png, jpeg, tiff or svg, defaults to png
prefix: 'img', // prefix for each image except svg, defaults to input filename
outdir: 'out' // path to output directory, defaults to current directory
})
.then(function(){
console.log('Conversion done');
})
.catch(function(err){
console.log(err);
});
Test
Make sure mocha
is installed, then run
npm test
License
MIT