1.0.3 • Published 8 months ago
pdfsnap v1.0.3
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
pdftoppmfor 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 -ymacOS (via Homebrew)
brew install popplerThen, install pdfsnap via npm or yarn:
npm install pdfsnapyarn add pdfsnapUsage
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.