pdfpage2image
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i pdfpage2image

Weekly Downloads

4

Version

1.1.5

License

none

Unpacked Size

11.3 MB

Total Files

8

Last publish

Collaborators

  • jeremyaube