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-fox

v1.3.2

Published

PDF to PNG converter using PDF.js

Downloads

1,064

Readme

pdf-fox

PDF to PNG converter for Node.js, powered by PDF.js and @napi-rs/canvas.

日本語

Install

npm install pdf-fox

CLI

# Convert all pages → 1.png, 2.png, ... next to the input
npx pdf-fox input.pdf

# Specify output directory → output/1.png, output/2.png, ...
npx pdf-fox input.pdf -o output/

# Convert a specific page → 2.png
npx pdf-fox input.pdf -p 2

# Save a single page to an explicit file
npx pdf-fox input.pdf -p 1 -o cover.png

# Set resolution (default: 200 DPI)
npx pdf-fox input.pdf --dpi 300
Options:
  -o, --output <path>       Output directory or file path
  -p, --page <number>       Page number to convert (default: all pages)
  -r, --dpi <number>        Resolution in DPI (default: 200)
  -b, --background <color>  Background color (default: white)
  -f, --font <name=path>    Substitute font for a non-embedded font (repeatable)
      --no-system-fonts     Disable automatic CJK system-font fallback
      --bold <px>           Thicken text by this width in px (e.g. 0.6; default: 0)
  -h, --help                Show help
  -V, --version             Show version

Text looks too thin?

PDF.js renders glyph outlines faithfully, so text can look lighter than in a browser, which applies extra font smoothing on macOS. Thicken it with --bold (or the stemDarkening option), e.g. --bold 0.6.

Non-embedded fonts

If a PDF references a font without embedding it, those glyphs would render as blank boxes. By default pdf-fox points the generic serif/sans-serif families at an available CJK system font (Hiragino, Yu, MS, Noto, …), so such text renders out of the box — just like Firefox falling back to system fonts. Disable this with --no-system-fonts for output that doesn't depend on installed fonts.

To use a specific font (e.g. when the system has none, or to match the original exactly), supply a local font file under the name the PDF uses:

npx pdf-fox input.pdf -f "MSMincho=~/Library/Fonts/msmincho.ttc"

The name (MSMincho) is the PDF's font name without its subset prefix (the part before +). You can inspect font names with pdffonts input.pdf.

Library

import { convertPdfToPng, convertPdfPageToPng } from "pdf-fox";
import { readFileSync } from "fs";

const pdf = readFileSync("input.pdf");

// All pages
const pages = await convertPdfToPng(pdf);
// => [{ pageNumber: 1, data: Buffer, width: number, height: number }, ...]

// Specific page
const page = await convertPdfPageToPng(pdf, 1, { scale: 2.0 });

// Substitute a non-embedded font
const rendered = await convertPdfToPng(pdf, {
  fonts: { MSMincho: "/path/to/msmincho.ttc" },
});

Options

| Option | Type | Default | Description | |---|---|---|---| | scale | number | 1.5 | Rendering scale (1.0 = 72 DPI) | | background | string | "white" | Background color (any CSS color string) | | fonts | Record<string, string> | {} | Substitute fonts for non-embedded fonts, mapping the PDF's font name to a local font file path | | systemFontFallback | boolean | true | Point serif/sans-serif at an available CJK system font so non-embedded CJK text renders. Disable for font-independent output | | stemDarkening | number | 0 | Thicken text by stroking glyph outlines with this width in output pixels, approximating browser font smoothing. 0 disables; try 0.51.0 |

Requirements

  • Node.js 18+