npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@willh/pdf-to-images

v1.0.2

Published

A CLI tool to convert PDF pages to individual images

Readme

@willh/pdf-to-images

CI/CD

A simple and efficient CLI tool to convert PDF pages into individual PNG images.

Features

  • 🚀 Convert each PDF page to a high-quality PNG image
  • 📁 Automatic output directory management with auto-numbering
  • 🔍 Input validation for file existence and extension
  • 📊 Progress tracking during conversion
  • 🔊 Verbose mode for detailed logging
  • ⚡️ High-quality output (3x scale, ~216 DPI)

Installation

You can use this tool directly with npx without installation:

npx -y @willh/pdf-to-images -i sample.pdf -o output

Or install it globally:

npm install -g @willh/pdf-to-images

Usage

Basic Usage

Convert a PDF file to images in the default output directory:

npx -y @willh/pdf-to-images -i sample.pdf -o output

Options

  • -i, --input <path> - (Required) Input PDF file path
  • -o, --output <path> - Output directory path (default: output)
    • If the directory exists, it will automatically append a number (e.g., output1, output2, etc.)
  • -f, --force - Overwrite existing output directory and files (disables auto-numbering)
  • --engine <engine> - Render engine: pdfjs (default) or chrome
    • chrome uses headless Chrome/Edge to render pages, which can better match browser PDF rendering and system font substitution.
  • --chrome-path <path> - Chrome/Edge executable path (only for --engine=chrome); can also set CHROME_PATH
  • --verbose - Enable verbose logging for detailed output
  • -v, --version - Display version number
  • -h, --help - Display help information

Examples

Convert with verbose output:

npx -y @willh/pdf-to-images -i document.pdf -o images --verbose

Render using headless Chrome (better system font substitution):

npx -y @willh/pdf-to-images -i document.pdf -o images --engine chrome

Overwrite output files in an existing directory:

npx -y @willh/pdf-to-images -i document.pdf -o images -f

Check version:

npx -y @willh/pdf-to-images -v

Get help:

npx -y @willh/pdf-to-images -h

Output

The tool will:

  1. Create the output directory if it doesn't exist
  2. Convert each page to a PNG file named as {filename}-{page}.png
    • Page numbers are zero-padded (e.g., 01, 02 for <100 pages, 001, 002 for ≥100 pages)
  3. Display progress during conversion

Example output files:

output/
├── sample-01.png
├── sample-02.png
├── sample-03.png
└── ...

Error Handling

The tool validates:

  • ✅ Input file exists
  • ✅ Input file has .pdf extension
  • ✅ Output directory can be created
  • ✅ PDF file is valid and readable

If any validation fails, the tool will exit with an error message.

Requirements

  • Node.js >= 20.16.0
  • CI uses Node.js 20.16.x and 22.x

License

MIT License - Copyright (c) 2025 Will 保哥

Author

Will 保哥

Repository

https://github.com/doggy8088/pdf-to-images

Issues

Report issues at: https://github.com/doggy8088/pdf-to-images/issues