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

mikser-io-post-pdf

v3.0.0

Published

HTML → PDF postprocessor for mikser-io, driven by puppeteer or puppeteer-core

Readme

mikser-io-post-pdf

HTML → PDF postprocessor for mikser-io, driven by puppeteer or puppeteer-core.

Renders any layout that produces HTML through a headless chrome and emits a PDF. The plugin is small; the work is in two places — picking which chrome to drive (your bundled, a system install, or auto-detected), and a long-lived browser instance kept warm across renders.

Install

Pick the install path that matches your environment.

Local dev / quick start — bundles a chrome download (~500 MB), works on any OS without extra setup:

npm install mikser-io-post-pdf puppeteer

Headless production server — uses your system chrome, no bundled download:

# 1. install a system chrome
sudo apt install -y google-chrome-stable

# 2. install the plugin + the lean driver (no chrome download)
npm install mikser-io-post-pdf puppeteer-core

The plugin accepts either driver — install whichever fits.

Add to your config

// mikser.config.js
import { documents, layouts, renderHbs } from 'mikser-io'
import { postPdf } from 'mikser-io-post-pdf'

export default {
    plugins: [
        documents(),
        layouts(),
        renderHbs(),
        postPdf({
            // 'auto' probes platform-typical chrome paths so the same
            // config works on macOS dev and Linux prod. Or set an
            // explicit path: '/usr/bin/google-chrome-stable'.
            executable: 'auto',
        }),
    ],
}

Any layout filename of the shape <name>.html-pdf.<engine> (e.g. report.html-pdf.hbs) is rendered through your chosen template engine to HTML, then post-processed by this plugin to a PDF at <name>.pdf in the output folder.

executable — picking which chrome to drive

Resolution precedence, in order. First match wins:

  1. config.launch.executablePath — the puppeteer-native field. Use for full control of every puppeteer.launch() option.
  2. config.executable — friendly top-level alias for the path.
  3. PUPPETEER_EXECUTABLE_PATH env var — puppeteer's standard env override. Useful for per-server overrides without touching config.
  4. config.executable: 'auto' — probes platform-appropriate locations and uses the first found. The recommended cross-OS default.
  5. Nothing set — falls back to puppeteer's bundled chrome (only available when you installed puppeteer, not puppeteer-core).

What 'auto' probes

macOS: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome, then Chrome Beta/Dev/Canary, Chromium, Microsoft Edge, Brave Browser.

Linux: /usr/bin/google-chrome-stable, /usr/bin/google-chrome, /usr/bin/chromium-browser, /usr/bin/chromium, /usr/bin/microsoft-edge-stable, /usr/bin/microsoft-edge, /snap/bin/chromium.

Windows: C:\Program Files\Google\Chrome\Application\chrome.exe, the x86 variant, then Microsoft Edge in both paths.

If 'auto' finds nothing, the plugin throws an actionable error listing every path it tried so you know what to install or where to put it. For non-standard installs (Homebrew chromium, /opt/chrome/..., etc.), set an explicit path — it always wins over 'auto'.

Options shape (all optional)

postPdf({
    // pick chrome (see above)
    executable: 'auto',

    // full puppeteer.launch() options when you need more than `executable`.
    // launch.executablePath wins over launch.executable when both are present.
    launch: {
        args: ['--font-render-hinting=none'],   // merged with defaults
        // headless, executablePath are managed by the plugin
    },

    // forwarded to page.goto() for each render
    navigation: {
        waitUntil: 'networkidle0',   // default
        timeout: 30000,
    },

    // forwarded to page.pdf() for each render
    pdf: {
        format: 'A4',                // default
        printBackground: true,       // default
        margin: { top: '10mm', bottom: '10mm', left: '10mm', right: '10mm' },
    },

    // when running with --watch, the browser is kept warm between
    // builds. Closed after this many idle ms (default: 60_000).
    teardownDelay: 60_000,
})

Default chrome flags

--no-sandbox and --disable-setuid-sandbox are applied by default because most headless Linux servers and Docker images can't set up Chrome's sandbox. They're merged (deduped) with any launch.args you supply, so adding --font-render-hinting=none doesn't drop them. To run with the sandbox, override launch.args explicitly.

How chrome is kept warm

One puppeteer browser instance is launched at startup. Every render opens a fresh page in that browser and closes it after page.pdf(). In --watch mode, the browser stays open between build cycles; the plugin schedules a teardown teardownDelay ms after the last render. In one-shot mode the browser closes immediately after the build.

License

MIT.