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

e2pdf

v0.1.0

Published

A lightweight, highly efficient, and customizable Node.js library for crawling websites and converting pages into compact, AI-optimized PDFs. Ideal for data archiving, offline analysis, and feeding content to AI tools. Delivers fast performance and allows

Downloads

612

Readme

Export Website to PDF

test Maintainability codecov Version Downloads npm bundle size Gitpod ready-to-code

A tiny, fast, and customizable Node.js library to crawl websites and save all pages as compact, AI-ready PDFs. Use it from the command line or as a module in your Node.js scripts. Perfect for data archiving, offline analysis, and feeding content to AI tools.

Features

  • Blazing Fast: Optimized for speed and performance.
  • Lightweight: Minimal resource usage for crawling and PDF generation.
  • Customizable: Full control over PDF formatting and crawling behavior.
  • AI-Optimized PDFs: Compact and structured for AI consumption.
  • Dual Usage: Use via CLI or integrate into Node.js scripts.

Star this repository and share it with your friends.

Installation

Install using pnpm, npm, or yarn

pnpm add e2pdf

or

npm install e2pdf

or

yarn add e2pdf

Usage

Command-Line Usage

To use e2pdf from the command line:

e2pdf <website-url>

For example:

e2pdf https://example.com

This will crawl the website and save all pages as PDFs in the current directory.

Node.js Script Usage

Here’s an example of using e2pdf in a Node.js script:

import e2pdf from "e2pdf";

(async () => {
  await e2pdf("https://example.com", {
    out: "./pdfs",
    pdf: {
      format: "A4",
      printBackground: true,
      margin: { top: "20px", bottom: "20px" },
    },
    crawlerOptions: { maxRequestsPerCrawl: 100 },
  });

  console.log("Crawling completed! PDFs saved to ./pdfs");
})();

API

The e2pdf function accepts two arguments:

  1. startUrl (string): The URL to start crawling from.
  2. options (E2PdfOptions): Configuration object for crawling and PDF generation.

E2PdfOptions

out

  • Type: string
  • Default: process.cwd()
  • Directory to save the generated PDFs.

pdf

PDF generation options (compatible with Playwright’s PDF options):

  • displayHeaderFooter: Display header and footer. Defaults to false.
  • footerTemplate: HTML template for the footer.
  • format: Paper format (e.g., A4, Letter). Defaults to Letter.
  • headerTemplate: HTML template for the header.
  • landscape: Paper orientation. Defaults to false.
  • margin: Margins for the PDF (top, right, bottom, left).
  • printBackground: Print background graphics. Defaults to false.
  • ...and many more options for fine-tuning PDFs.

crawlerOptions

Options for the Crawlee PlaywrightCrawler.

crawlerConfig

Configuration for Crawlee’s Configuration object.

Contributing

We welcome contributions! Please fork the repository and submit a pull request.

License

This library is licensed under the MPL-2.0 open-source license.

Feedback and Support

If you encounter any issues or have suggestions, please open an issue or contact us. We’d love to hear from you!

Please enroll in our courses or sponsor our work.