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

v1.1.3

Published

使用 ImageMagick 导出 PDF 页面为 JPG,或把图片目录合并为 PDF 的命令行工具(CLI 命令:pdf-fetch)

Downloads

112

Readme

pdf-fetch(CLI:pdf-fetch)

一个简单的命令行工具:使用 ImageMagick(magick) 从 PDF 中提取页面并导出为 JPG。

前置条件

  • macOS(你当前需求场景)
  • 已安装 ImageMagick,并确保命令 magick 可用

安装

pnpm add -g pdf-fetch

使用

无参数时会输出中文使用说明:

pdf-fetch

合并图片目录为 PDF(与导出相反):

pdf-fetch -m "./name"

转换整个 PDF:

pdf-fetch "name.pdf"

指定分辨率/质量:

pdf-fetch "name.pdf" -d 200 -q 100

指定输出文件名前缀 + 指定页码:

pdf-fetch "name.pdf" -n "new" -p 10-15,20

行为规则

  • 在 PDF 所在目录创建同名文件夹(去掉 .pdf 扩展名),例如 name.pdf./name/
  • 默认导出所有页面
  • 默认 DPI:150(-d 200 可改)
  • 默认 JPG 质量:95(-q 100 可改)
  • 默认文件名:p01.jpg, p02.jpg ...,序号从 01 开始(支持 -n 修改前缀,例如 new01.jpg
  • 如果目标 JPG 文件已存在:报错退出(符合你的覆盖策略要求)
  • 合并模式:-m ./name 会按文件名顺序(如 p01.jpg, p02.jpg ...)合并目录内图片并生成 ./name.pdf
  • 合并模式会以 p01.jpg(若存在)作为基准图片尺寸,把后续图片统一处理为同样的像素尺寸,确保每页大小一致
  • 合并模式的 -d/--dpi 会影响生成 PDF 的页面物理尺寸:建议与导出时的 -d 保持一致,这样“解包再合并”更接近原始 PDF
  • 合并模式会用基准图片生成 PDF 的首页缩略图(写入到 PDF 首页的 Thumb 字段)

开发

pnpm i
pnpm run lint
pnpm run typecheck
pnpm run build