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-fs-reducer

v1.0.2

Published

Reduce PDF file size with Ghostscript from CLI or JavaScript API.

Downloads

316

Readme

pdf-fs-reducer

Reduce PDF file size by downsampling embedded images through Ghostscript.

npm version License: MIT

Prerequisites

Ghostscript must be installed and available in your system PATH.

| Platform | Install command / link | | --- | --- | | macOS | brew install ghostscript | | Ubuntu / Debian | sudo apt install ghostscript | | Windows | https://www.ghostscript.com/download/gsdnld.html |

Usage

npx pdf-fs-reducer <input.pdf> [options]

Examples

# default mode (ebook preset)
npx pdf-fs-reducer report.pdf

# custom output file path
npx pdf-fs-reducer report.pdf -o report.reduced.pdf

# smallest output for screen viewing
npx pdf-fs-reducer report.pdf --preset screen

# force custom image DPI (overrides preset)
npx pdf-fs-reducer report.pdf --dpi 120

# reduce quality by 30% from base DPI
npx pdf-fs-reducer report.pdf --size 30

# high quality print-oriented output
npx pdf-fs-reducer report.pdf -p printer -o report.print.pdf

Options

| Flag | Description | Default | | --- | --- | --- | | <input> | Input PDF path (required positional argument) | n/a | | -o, --output <path> | Output PDF path | <input-basename>.reduced.pdf in same directory | | -p, --preset <name> | Quality preset (screen, ebook, printer, prepress) | ebook | | -d, --dpi <number> | Custom DPI, overrides --preset | n/a | | -s, --size <percent> | Reduce quality by percentage (example: 30 means 30% lower quality) | n/a | | -c, --compatibility <ver> | PDF compatibility level | 1.4 | | -V, --version | Show version | n/a | | -h, --help | Show help | n/a |

Presets

| Preset | DPI | Best use | | --- | --- | --- | | screen | 72 | smallest size, on-screen viewing | | ebook | 150 | balanced quality and file size | | printer | 300 | high-quality printing | | prepress | 300+ | maximum quality for publishing |

Programmatic API

Install:

npm install pdf-fs-reducer

Use in Node.js:

const { PdfFilesizeReducer } = require("pdf-fs-reducer");

async function run() {
  const result = await PdfFilesizeReducer.reduce({
    input: "./input.pdf",
    output: "./output.pdf",
    preset: "ebook",
    size: 30,
    compatibility: "1.4"
  });

  console.log(result);
}

run().catch(console.error);

Return value:

{
  inputPath: "absolute-input-path",
  outputPath: "absolute-output-path",
  inputSize: 123456,
  outputSize: 98765,
  saved: 24691,
  percent: 19.99,
  effectiveDpi: 105,
  qualityReduction: 30
}

Sample output

pdf-fs-reducer
------------------------------------------------------------
Input : C:\docs\report.pdf (8.91 MB)
Output: C:\docs\report.reduced.pdf
Mode  : eBook (150 DPI) - balanced quality and size
Engine: gswin64c
------------------------------------------------------------
- Processing PDF (3s)
Completed.
Original: 8.91 MB
Reduced : 3.72 MB
Saved   : 5.19 MB (58.2% reduction)
Saved to: C:\docs\report.reduced.pdf

How It Works

pdf-fs-reducer calls Ghostscript (pdfwrite) to rebuild the PDF with lower image resolution.
In custom DPI mode, images are downsampled with bicubic interpolation.
With --size, the tool converts quality reduction percentage into an effective DPI (baseDPI * (1 - size/100)).
Text and vector drawing instructions are preserved, so reductions mainly come from image-heavy pages.

License

MIT