pdfpage2image
v1.1.5
Published
Convert a single page from a pdf to an image
Downloads
16
Readme
PDFpage2Image
Installation
To install, use npm.
npm install pdfpage2image
Description
This is a fork of pdf2images
This version add functionnality to convert a single pdf page as an image. It also rewrites the entire library in Typescript
Code example
// Get the path to the pdf (Must be absolute)
let pdfPath = path.join(__dirname, "file.pdf");
Convert(pdfPath, 1, { quality: 200 })
.then(imgBuffer => {
// Save the image here or do what ever you want
})
.catch(err => {
// Oops...
});
Options
1. pdfPath
:
The absolute path to the pdf fie
2. PageNumber
:
The page number to convert to an image (starts with 1)
3. Options
:
useLocalGs
:
Set this true if you want to use an own local ghostscript installation
int quality [ = 200]
:
The quality (dpi) of the output PNGs.
Tests
Tests are made with Jasmine and are under the spec
directory
To run tests, execute the following command:
npm test