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

pdf-image-converter

v0.3.0

Published

Convert PDF to images in Node.js (PNG, JPEG, BMP, PPM, ICO, TIFF). Fast, zero-dependency, TypeScript-first with NestJS support.

Downloads

245

Readme

pdf-image-converter

🚀 Convert PDF pages to images in Node.js — fast, lightweight, and zero dependencies.

npm version Downloads License: MIT


✨ Why pdf-image-converter?

Stop dealing with heavy tools like ImageMagick or Ghostscript.

pdf-image-converter is a modern, zero-dependency solution built for speed, simplicity, and production use.

✔ No native installs

✔ Works out of the box

✔ Built with TypeScript

✔ Perfect for APIs, microservices, and NestJS apps


🆕 What's New

🎉 New in this version

  • 🆕 ICO support — generate icons directly from PDFs
  • 🆕 TIFF support — high-quality image output for professional workflows

⚡ Features

  • Blazing Fast — Powered by WASM for high performance

  • 📦 Zero Dependencies — No external binaries required

  • 🖼 Multiple Formats Supported:

    • PNG
    • JPEG
    • BMP
    • PPM
    • 🆕 ICO
    • 🆕 TIFF
  • 🧩 Flexible API — Convert single, multiple, or all pages

  • 🦅 NestJS Ready — First-class integration

  • 🎨 Customisable Output — DPI, quality, and page selection

  • 💠 Fully Typed — Built with TypeScript


📦 Installation

npm install pdf-image-converter

🚀 Quick Start

import { pdfConverter } from "pdf-image-converter";
import fs from "node:fs/promises";

async function convert() {
  const pdfBuffer = await fs.readFile("document.pdf");

  const result = await pdfConverter.convertPage(pdfBuffer, 1, {
    format: "png",
    dpi: 300,
  });

  await fs.writeFile("page1.png", result.buffer);
}

🔥 Advanced Usage

import { PdfConverter } from "pdf-image-converter";

const converter = new PdfConverter({
  dpi: 200,
  format: "jpeg",
});

async function convertAll(pdfBuffer: Buffer) {
  const pages = await converter.convertAll(pdfBuffer, {
    quality: 85,
  });

  console.log(`Converted ${pages.length} pages`);
}

async function convertSpecific(pdfBuffer: Buffer) {
  const results = await converter.convertPages(pdfBuffer, [1, 3, 5]);
}

🧠 Supported Formats

const formats = pdfConverter.supportedFormats();
console.log(formats);

Output:

png, jpeg, bmp, ppm, ico, tiff

🏗 NestJS Integration

1. Import Module

import { Module } from "@nestjs/common";
import { PdfImageModule } from "pdf-image-converter/nestjs";

@Module({
  imports: [
    PdfImageModule.forRoot({
      defaultDpi: 150,
      defaultFormat: "png",
    }),
  ],
})
export class AppModule {}

2. Inject Service

import { Injectable } from "@nestjs/common";
import { PdfImageService } from "pdf-image-converter/nestjs";

@Injectable()
export class AppService {
  constructor(private readonly pdfService: PdfImageService) {}

  async processPdf(pdfBuffer: Buffer) {
    const totalPages = await this.pdfService.getPageCount(pdfBuffer);
    return this.pdfService.convertAll(pdfBuffer);
  }
}

📚 API Overview

PdfConverter

  • convertPage(pdf, page, options)
  • convertAll(pdf, options)
  • convertPages(pdf, pages, options)
  • getPageCount(pdf)
  • supportedFormats()

⚙️ Options

| Option | Type | Description | | ------- | ------ | ------------------------------ | | format | string | png, jpeg, bmp, ppm, ico, tiff | | dpi | number | Resolution (default: 150) | | quality | number | 1–100 (JPEG/PNG compression) |


💡 Use Cases

  • 📄 Document preview generation
  • 🖼 Thumbnail creation
  • 📦 File processing pipelines
  • 🧾 PDF-to-image APIs
  • 🎯 Icon generation (ICO support!)

❤️ Contributing & Support

If this package helped you:

  • ⭐ Star the repo
  • 🐛 Report issues
  • 💡 PRs & ideas are always welcome!

It helps more developers discover this package 🚀


📄 License

MIT © 2026