Skip to content

A Node.js utility for converting a PDF to a PNG or JPEG image using pdftoppm.

License

Notifications You must be signed in to change notification settings

nurassyl/pdfsnap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdfsnap

pdfsnap is a simple Node.js utility for converting a PDF to a PNG or JPEG image using pdftoppm.

Features

  • Supports PNG and JPEG formats.
  • Uses pdftoppm for fast and accurate conversion.
  • Simple API for easy integration.

Installation

Ensure you have Poppler installed on your system:

Ubuntu/Debian

sudo apt update && sudo apt install poppler-utils -y

macOS (via Homebrew)

brew install poppler

Then, install pdfsnap via npm or yarn:

npm install pdfsnap
yarn add pdfsnap

Usage

const { pdfsnap } = require('pdfsnap');

pdfsnap({
  pdfPath: 'sample.pdf',
  outputPath: 'output.png',
  format: 'png',
  dpi: 300,
})
  .then(filePath => console.log('Image saved at:', filePath))
  .catch(error => console.error('Error:', error));

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Node.js utility for converting a PDF to a PNG or JPEG image using pdftoppm.

Resources

License

Stars

Watchers

Forks

Packages

No packages published